PullParser2.1.10/0000755000175000017500000000000010232453525014032 5ustar wbaerwbaer00000000000000PullParser2.1.10/doc/0000755000175000017500000000000010232455233014575 5ustar wbaerwbaer00000000000000PullParser2.1.10/doc/ABOUT.txt0000644000175000017500000000027107755336263016231 0ustar wbaerwbaer00000000000000Xml Pull Parser 2 for more information please see: http://www.extreme.indiana.edu/soap/xpp Copyright (c) 2001 Extreme! Lab, Indiana University License http://www.extreme.indiana.edu PullParser2.1.10/doc/build.html0000644000175000017500000000215307755336263016604 0ustar wbaerwbaer00000000000000 Building Pull Parser 2

Building Pull Parser 2

NOTE: XPP2 distribution already contains JAR files and precompiled samples so building is not necessary unless you make changes to XPP2.

First check requirements

Make sure to have JUnit to compile tests - JUnit 3.7 JAR is included in lib directory so just add it to CLASSPATH

set CLASSPATH=lib\junit37.jar

To build everything from scratch call ant in top level directory (build everything except J2ME - see seaprate instructions)

ant all

and to build only modified files

ant

TO build J2ME samples see a separate document.

[Back To Pull Parser 2 Documentation]


Aleksander Slominski
PullParser2.1.10/doc/changes.html0000644000175000017500000002022707755336265017121 0ustar wbaerwbaer00000000000000 Pull Parser 2 Changes

Changes to Pull Parser 2 (XPP2)

2004- (XPP_2_1_11)

2003-11-15 (XPP_2_1_10)

2003-03-07 (XPP_2_1_9)

2002-04-03 (XPP_2_1_8)

2001-12-10 (XPP_2_1_7)

2001-11-21 (XPP_2_1_6_ALPHA)

2001-11-20 (XPP_2_1_5_ALPHA)

2001-10-18 (VER_2_1_4_ALPHA)

2001-10-18 (VER_2_1_3_ALPHA)

2001-10-10 (VER_2_1_2_ALPHA)

2001-08-20 (XPP_VER_2_0_2 is the same as VER_2_0_1_BETA8)

Stable 2.0.2 version released and frozen! Summary of changes since initial 2.x version:

2001-08-20 (VER_2_0_1_BETA8)

2001-08-19 (VER_2_0_1_BETA7)

2001-08-18 (VER2_0_1_BETA6)

2001-08-16 (VER_2_0_1_BETA5)

2001-08-16 (VER_2_0_1_BETA4)

2001-08-15 (VER_2_0_1_BETA3)

2001-08-14 (VER_2_0_1_BETA2)

2001-08-12 (VER_2_0_1_BETA)

 

[Back To Pull Parser 2 Documentation]

 


Aleksander Slominski
PullParser2.1.10/doc/dump1_sample_xml_input.jpg0000644000175000017500000005253407755336261022015 0ustar wbaerwbaer00000000000000WANG2JFIFC   (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcC//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc! }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?{uѧ[H-y'8QAmH1ih1z9'%˖)i}SzwE-[RԴ"Pg(T1\ ǜǿZ2OGkjt8Tnq^ɯR(O6:6.y'>_/? _Q^W!D,BFI֮C6/ai<V ~HUN Vr.DL ׽RK#[G!bRwvd!H1fB@fu(9''X_eN-ekI^?_sIё\dF>x&}Ƙ<~qjv_,ym$EefJ;RQNS )(`S5~ 3]sTEˁ7J֎a] q+UW,|Cտ{/5qZ ),GvJ&}>4/%"hUj(abiDncSN)a)4oAhSYM:Y4d"b)jP {PHd1ʍ~h m'94ʫgrۏoV%mG`a] q+UW,|Cտ{/5qa]gAk߽ڄB>Q-SyExXg'{V4V.[8 x9[sZVsa K{r`oܹ`ޟ?5KlBwĨ/SUIXm3,+ʯ56(K۳XR[K:L ʏy::E. Uclw6A-cS{c6FdJKcBlBEePgBϸ CZѴptRrImN:Oh]gʵm|U^ۼn۰`whW\VpD ?2dj!ѬSP?l&W߀lis?5[85Jx5%FF ^;=2lY2c{UŽ]+<J?}5ScEۏoV%oCȷ}?"EefZ; +wIm,y۽0G,c08޵M\BliQ^Z\hgkyϿ#pzv!`?u3\F1rČT.8V| zq⦸<mk/'XORA{#Q^khiwْY|J|[oͮ8n001<{ qb, 2L p"[4XmhmG E| Y1aEve1:@4Bm/QdG t#&l-L"9.W2-&t&I#>c_[]%٢O78CᛴtK۹mo pH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z/gǯY]بk< 6L6KҧVRۯnjCmg9VŽ(8F:ͺp%$?N]|/S ^cZ(V, ^U?/4KI1gh$a(8w~43N6+[I'ciDs4~h: IR EWAc" UD3o^rս/ n;jkp 2F QPMn eWR|_MnmmAdn>ϥeŽ~[n*S)ijB~RU<׊:i3[ʑHE(IKbO-##h r˃߿^{ӴtknTϧ&E9: TiqضqY\%i1D\&SoO0C{x''>J H\t_}oZE c|)SLm71ȿy $ucBغ?,?E'?{;="5ڪ2yf#/%nLq+gUm'$r@< ]$t6?-_OMM_3o^rս? b,!V֬12Ozގm%YNTtžIA= &4[bNp<~_8P@gŚń'.sѷ\`՛vz*sIj:$+n?j'kmZ!0lqVQ&8JR$qիMc0G%dgkq+,L[ZT/Ja Ϲ8N*q\OtboX Sx#YpCLMKK@e:Zl$) ;pka$,MR&2c8X&FWv"ȷ}?-|BͿ{/5&U*DszʢCDqRkf5|g t> @/hhh2 d0#<fؓ)"Hdd_efK,Kl|o|t4Պa;K2\c#@h[lCh;z7 xwL<°5?c1ء-sv ,:!W!R¨E+{ڨX`V{-|BͿ{/5ߺŠ (!jtlQ\#mP 9du#k0,}4MxϳUG?4X*M8Oqr7NO}O35ˁ/#9˹oMzbz:%nQ+P (EZ!_k0($t8gb>H)AYH(G֎I 9'G#vSfP2IhRRE_Ե+mNMw#RdaUL ԩ+&;t_hΛ@>yw t_hoa4,,L_O% 4s˸,L_O% 4sKX?Y@GK?hpij1?Ə&/'% 4ij1?Ǝf; d1&/'`,L_Ogbgb,L_O񣙅% 4,L?Ƌ&Nho|+F;lPullParser2.1.10/doc/dump2_xml_output.jpg0000644000175000017500000005173607755336263020663 0ustar wbaerwbaer00000000000000WANG2JFIFC   (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcC//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc! }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDE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:x&Y&:촽6 2ʄbr"iT9!\ |]{B%gh$5oggZƻUF],S@$p3= ɑ>lm>@sZHT:DEkmZ!085lE$*zՆ I^{آXЍ)ʑ]Ηxi(#xǡƋtTP)PБNҘ Z(5Rߗ#~6^y:AAPbiV6DN3ڵtIf(OĬn#e+~cS L2s4g%Tn>VW+*oz`\.pA֞pi isH gXM!n==q$C33;eBdQ xgQVE_efZޟ„ŠHsYT\hî*T}r аԦ|OAӨz fA"~g֣1,e;d\`= 앀emL6\g~ x_kdx5mm68Sf⁚wnO1'Vf;%nnEY٤2&URRLGҲ5bߥ8H?+>I`1 2w45g9$(`0QJFI=M`Qp J@Xȷ}?2 m ؤuPL0709%d`Λ@.`Λ@-L?Ɨ<% 4ij1?Ǝyw% 4ij1?Ǝiw K?hgb&/'d9pij1?Ə&/'a?Y@F4d\% 4,L_O񣙀,L_O% 4s0ij1?Ɨ% v_iBm-W/brHPullParser2.1.10/doc/dump2_xml_output_on_RIM.jpg0000644000175000017500000005331407755336263022060 0ustar wbaerwbaer00000000000000WANG2JFIFC   (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcC//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc6! }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?{uѧ[H-y'8QAmH1ih1z9'%˖)i}SzwE-[RԴPg(T1\ ǜǿZ3煟?[Sǘʣpa:8xP6ixڇGiŷ}^!ߟck~Wv8xx߿8xy[߿!e_\BϖOKVRSh҆}hZ:%t;Ad څ&Aef_*;+% ncn3nL3Έ9 a]cuzRmE+m&ҞI#dihհ<)m#oX^ x vUE}@l7$Vmeq õfP p0 8'RkUn6461ֱ?ĂUُFIޙ $m[|28nI i+hbx xxZ4z*}QaEn빿@S\1?(a0"<O@a>l> jpHtCk\(t<8cƏVQ@Ou9C\eE/5818ȧ ^d8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r?>=W^M7ʀS ׻PM=i@ 2M,ǫ}'*E!^(UsGR-2ARPE:_u?emHE{o V(((pSnlzmjP[XKiyLm}'=qykLaJ|Q+GWi_>ҿ}(RxQKGڗ€/j_ >Կ}(RxQKGڗ€/j_ >Կ}(RxQKGڗ€/'ߥk_~}PGրk_Z>=i>(XcgYHNq9h<9L%ć|S;{3֤"?PullParser2.1.10/doc/dump6_palm_xml_output.jpg0000644000175000017500000010244207755336261021665 0ustar wbaerwbaer00000000000000WANG2JFIFC   (1#%(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egcC//cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc! }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?32rz88h\\\\\\/GGGƀ.AO*OA<=?C@h Tʃ4yPz~*OVΏ*[:<O@o?\Ώ.O@G\yp{G'ˇi|=  j6AlѨPFd@=z5 j6AlѨPFd@?:L&|AS<84iSWBK=6e;]d=i_tiI^Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@eF٧-Wʗ:?jod?g*Y!q@LQFYL)cӥ٧I#*N@W ?շҀ3eb$8$~4Lj (/T /oi6.FP<RWBU4&,z4Z R6м*P֖^\)XԭEJƿӮt\'~CjO :ƟlV69?PM7P #`")`|nW'h4ukDeBqZ€0mKwev5PWll.dnWrG iW>ERK|Py##}$mPEPEPEPEu>ݦ]2jH#,^?p8rNuA>t{KPdH}ۅΠ'Pd 277[Kt 1"d68_ZѹӢѯ&#c#'Yi <2褓5ch47 P{.1]KdFhH E]ܸˤ@(nYvG&FmųhҴMFU221\<~_[jSigom\Z *LgGo M^->}+Bi-mbđ|'imsE4iQu{۫tIhǞOMIask `\vrE145p>`?*o.Ėv v>P( ( ( (IϹMH+vBt.ddI9l>  j?շҀ3&Xi>( jv,rhimGRkI|#=VеCraEHⵥ~sBC]g\Я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ϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟ѣϛz}<笟Ѧ8û0'4PullParser2.1.10/doc/faq.html0000644000175000017500000000364707755336265016267 0ustar wbaerwbaer00000000000000 Pull Parser 2 FAQ

Pull Parser 2 FAQ

How to access the latest source code?

The latest packaged releases are available at http://www.extreme.indiana.edu/soap/ and the latest source (if you want to be on the cutting edge) can now be obtained now from anonymous CVS at:

cvs -d :pserver:anonymous@cvs.extreme.indiana.edu:/l/extreme/cvspub login
CVS password: cvsanon

cvs -d :pserver:anonymous@cvs.extreme.indiana.edu:/l/extreme/cvspub co xsoap-java/PullParser

Why XPP blocks when reading from input stream such as socket?

NOTE:pleasue use XPP version 2.1.8 or higher - in previous version there is ogg-by-one buffering bug.

XPP is a streaming parser however it depends on Reader to provide data in timely manner. The current JDK implementattion of InputStreamReader will try to read 8KB into internal buffer unless InputStream.available() function returns 0 (this behavior can not be overriden).

Therefore it is necessary to use a wrapper around InputStream to make sure that InputStreamReader will return as soon as data is available, for example:

public class NoBufferingInputStream
        extends FilterInputStream {

        public NoBufferingInputStream(InputStream in) {
            super(in);
        }

        public int available() { return 0; };

}

then one would use following construct to create Reader:

InputStream socketInput = ...;
xpp.setInput(new InputStreamReader(
  new NoBufferingInputStream(socketInput)));

[Back To Pull Parser 2 Documentation]

 


Aleksander Slominski
PullParser2.1.10/doc/j2me.html0000644000175000017500000001027507755336263016346 0ustar wbaerwbaer00000000000000 Pull Parser 2 and J2ME

Pull Parser 2 and J2ME

J2ME version requirements

Running samples

Precompiled midlet JAR/JAD and Palm PRC are in build/j2me directory - see below for some screenshots.

Running count midlet sample

It will require to start emulator and pass to it location of count mildlet JAD file (that points to JAR file)

Following command line can be used (modify to point to you J2MEWTK location) c:\jdk1.3.1\bin\java -Dkvem.home=d:\J2mewtk -cp d:\J2mewtk\wtklib\kvem.jar;d:\J2mewtk\wtklib\kenv.zip;d:\J2mewtk\wtklib\lime.jar com.sun.kvem.midp.Main i85s -descriptor build\j2me\count_midlet.jad

try also to use other emulators instead of i85s skin (like RIMJavaHandheld) see few examples below.

Running count midlet in Palm OS Emulator

Following command line can be used to run midlet in Palm OS Emulator (POSE) - make sure to modify to point to you J2MEWTK location: c:\jdk1.3.1\bin\java -Dkvem.home=d:\J2mewtk -cp d:\J2mewtk\wtklib\kvem.jar;d:\J2mewtk\wtklib\kenv.zip;d:\J2mewtk\wtklib\lime.jar com.sun.kvem.midp.Main PalmOS_Device -descriptor build\j2me\count_midlet.jad

and when it ask for POSE point it to location where is installed PalmOS Emulator that has Java runtime from MIDP4PALM installed.

NOTE: Palm must have at least 4MB of RAM but i have only run this sample with 8MB (and 2MB is definitely too small...).

Building J2ME version

NOTE: XPP2 distribution already contains JAR files and precompiled samples so building is not necessary unless you make changes to XPP2.

I have included slightly modified Stampysoft Ant Tasks (written by Josh Eckels). Make sure to add it to CLASSPATH (and have already set as described in build document).

set CLASSPATH=%CLASSPATH%;lib\StampysoftAntTasks_Alek.jar

Building midlets

Modify build.xml to include J2MEWTK instalation location

  <property name="j2mewtk.home" value="d:/j2mewtk" />

Now build can be performed:

ant j2me

Building midlet for Palm OS

Make sure to build midlet succesfully with J2MEWTK (see above).

Modify build.xml to include MIDP4PALM instalation location

  <property name="midp4palm.home" value="D:\palm\midp4palm1.0\Converter" />

Then you can start build:

ant palm

Demonstration

Example of XML entered into Motorola i85s and Palm m500 emulator:
and parsing result displayed on Motorola and RIM Java Handheld:
and on Palm as well:

And second example with invalid input
resulting in parsing error

[Back To Pull Parser 2 Documentation]


Aleksander Slominski
PullParser2.1.10/doc/overview.html0000644000175000017500000000322707755336261017354 0ustar wbaerwbaer00000000000000 Pull Parser 2 Overview

Pull Parser 2 Overview

New features since previous version

It is a major revision of previous 1.1 version.

  • clean separation between interfaces and implementation - alternative implementations of XPP2 interfaces are now possible and can be easily integrated thanks to JAXP-like pluggablity (user source code won't need to change at all!)
  • contains two ultra lightweight Java XML tree representation: XmlNode must be constructed before used but XmlPullNode allows for combined pull parsing and incremental tree construction with ability to skip parts of tree and dynamically modify its content (allow to store _any_ object).
  • J2ME MIDP support and samples (standard XppCount sample with the same implementation shared between J2ME Midlet and command line J2SE version)
  • sample that shows XML node tree of XML file in SWING tree
  • allow users to access underlying buffer parser (to avoid creating String to represent element content)
  • added interfaces to record and format XML output
  • it is faster by 10% than previous Pull Parser 1.1
  • whole jar archive containing interfaces and implementation is just 40K (including tree node handling)
  • some small bug fixes and improvements to tokenizer and parser

[Back To Pull Parser 2 Documentation]


Aleksander Slominski
PullParser2.1.10/doc/reqs.html0000644000175000017500000000227407755336263016463 0ustar wbaerwbaer00000000000000 Pull Parser 2 Requirements

Pull Parser 2 Requirements

Hardware

This is utility software and is designed to run from J2ME devices (such as Palm Pilot and Java enabled telephones) to J2EE servers.

Software

  • JDK 1.1 or better for all code except SWING sample. to build SWING sample JDK 1.2 or better is required.
  • working ANT 1.3 instalation to build from source (not required as precompiled code is included)

    JUnit 3.7 to compile automatic tests [included in lib subdirectory] and ANT 1.3 JUnit optional task to run junit tests from ant (ANT optional tasks JAR must be downloaded and installed). However if necessary tests can be run manually

  • requirements to build and run J2ME JAR version and sample midlets are in separate document.

    [Back To Pull Parser 2 Documentation]


    Aleksander Slominski
    PullParser2.1.10/doc/run.html0000644000175000017500000000451107755336263016311 0ustar wbaerwbaer00000000000000 Running Pull Parser 2.0

    Running Pull Parser 2.0

    For description of how to run J2ME samples see separate document.

    First make sure to add JUnit 3.7 to CLASSPATH and add to CLASSPATH Pull Parser 2 JAR and directory with compiled samples and tests. Optionally add Xerces 2 jar file to use XPP2 implementation that is based on Xerces XNI. To implement fully XPP2 interfaces it was necessary to patch Xerces 2 and both patch and jar file of modified Xerces are available in lib\xerces2_patched so jar file can be added to use Xerces 2 based implementation of XPP2.

    The CLASSPATH to use may look like this:

    set CLASSPATH=build\samples;build\tests;build\lib\PullParser_VERSION.jar;lib\junit\junit37.jar;lib\xerces2_patched\xercesImpl_2_0_1_event_position_patch.jar
    

    Running automatic tests

    To verify that XPP2 is working automatic JUnit tests must be executed first:

    ant junit
    

    If ant is not available use following command instead:

    java AllTests
    

    Expected output should say OK reporting number of tests run, ex:

    ........
    Time: 0.431
    
    OK (8 tests)
    

    Running samples

    [XppNodeTree running]

    Count

    This is simple sample that demonstrates how to use XML Pull Parser and with different options. In the most basic setup it dumpls file content and provides some statistics about it. It can be also used to measure speed of parsing.

    java standard.XppCountMain -help
    

    Example invocations:

    java standard.XppCountMain build.xml
    java standard.XppCountMain build.xml -s 1000
    java standard.XppCountMain build.xml -s 1000 -H
    

    SWING Node Tree

    This sample demonstrates use of XmlNode to construct and display XML element tree in SWING JTree widget. JDK 1.2 or better is required.
    java swing.XppNodeTree build.xml
    

    [Back To Pull Parser 2 Documentation]

     


    Aleksander Slominski
    PullParser2.1.10/doc/THANKS.txt0000644000175000017500000000043207755336265016350 0ustar wbaerwbaer00000000000000* Philip Shepherd helped in finding buffer by one bug in tokenizer and that is very important when XML must be parsed as it comes in so XPP doe snot hang waiting for one byte when event is already available patch to update XPP2 X2PullParser to the latest Xerces 2.0.1 XNI API PullParser2.1.10/lib/0000755000175000017500000000000007755336255014620 5ustar wbaerwbaer00000000000000PullParser2.1.10/lib/ant/0000755000175000017500000000000010232455076015365 5ustar wbaerwbaer00000000000000PullParser2.1.10/lib/ant/lcp.bat0000644000175000017500000000032407755336254016646 0ustar wbaerwbaer00000000000000set _CLASSPATHCOMPONENT=%1 :argCheck if %2a==a goto gotAllArgs shift set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1 goto argCheck :gotAllArgs set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH% PullParser2.1.10/lib/ant/LICENSE.txt0000644000175000017500000000522207755336265017227 0ustar wbaerwbaer00000000000000/* * ============================================================================ * 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 . * */ PullParser2.1.10/lib/ant/README.txt0000644000175000017500000000016407755336265017102 0ustar wbaerwbaer00000000000000Contains all that is required to build package with ANT For more details please see: http://jakarta.apache.org/ant/ PullParser2.1.10/lib/ant/StampysoftAntTasks-license.txt0000644000175000017500000000203707755336265023410 0ustar wbaerwbaer00000000000000Copyright (c) 2001 Josh Eckels Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PullParser2.1.10/lib/junit/0000755000175000017500000000000010232453551015730 5ustar wbaerwbaer00000000000000PullParser2.1.10/lib/junit/LICENSE.txt0000644000175000017500000002705407755336265017605 0ustar wbaerwbaer00000000000000 from http://junit.org/ "JUnit is a regression testing framework written by Erich Gamma and Kent Beck. It is used by the developer who implements unit tests in Java. JUnit is Open Source Software, released under the IBM Public License and hosted on SourceForge." IBM Public License Version 1.0 is available at: http://oss.software.ibm.com/developerworks/opensource/license10.html IBM Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of International Business Machines Corporation ("IBM"), the Original Program, and b) in the case of each Contributor, i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means IBM and any other entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Original Program" means the original version of the software accompanying this Agreement as released by IBM, including source code, object code and documentation, if any. "Program" means the Original Program and Contributions. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Each Contributor must include the following in a conspicuous location in the Program: Copyright {date here}, International Business Machines Corporation and others. All Rights Reserved. In addition, each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. IBM may publish new versions (including revisions) of this Agreement from time to time. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. No one other than IBM has the right to modify this Agreement. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. PullParser2.1.10/lib/junit/README.txt0000644000175000017500000000007307755336265017450 0ustar wbaerwbaer00000000000000Latest JUnit 3.7 jar downloaded from http://www.junit.org/ PullParser2.1.10/lib/midpapi/0000755000175000017500000000000010232454570016224 5ustar wbaerwbaer00000000000000PullParser2.1.10/lib/xerces2_patched/0000755000175000017500000000000010232454566017651 5ustar wbaerwbaer00000000000000PullParser2.1.10/lib/xerces2_patched/event_position_patch_for_Xerces_2_0_1.txt0000644000175000017500000003015607755336265027715 0ustar wbaerwbaer00000000000000Index: src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java,v retrieving revision 1.10 diff -b -w -u -r1.10 XMLDocumentFragmentScannerImpl.java --- src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java 29 Jan 2002 03:44:36 -0000 1.10 +++ src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java 3 Apr 2002 06:01:57 -0000 @@ -294,6 +294,26 @@ /** Default constructor. */ public XMLDocumentFragmentScannerImpl() {} // () + // ALEK augmentation names to record start tag and end tag event position in input + public final String POS_ABSOLUTE_START = "http://gjt.org/xpp/pos-absolute-start"; //ALEK + public final String POS_ABSOLUTE_END = "http://gjt.org/xpp/pos-absolute-end"; //ALEK + protected Augmentations fAugmentations = new AugmentationsImpl(); //ALEK + + private void recordPosAbsoluteStart(String functionName, int off) { + int posAbsoluteStart = fEntityScanner.getCurrentEntityAbsoluteOffset() + off; //ALEK + if (DEBUG_CONTENT_SCANNING) System.out.println( + ">>> "+functionName+" recorded position absolute start="+posAbsoluteStart); + fAugmentations.putItem(POS_ABSOLUTE_START, new Integer(posAbsoluteStart)); //ALEK + } + + private void recordPosAbsoluteEnd(String functionName, int off) { + int posAbsoluteEnd = fEntityScanner.getCurrentEntityAbsoluteOffset() + off; //ALEK + if (DEBUG_CONTENT_SCANNING) System.out.println( + ">>> "+functionName+" recorded position absolute end="+posAbsoluteEnd); + fAugmentations.putItem(POS_ABSOLUTE_END, new Integer(posAbsoluteEnd)); //ALEK + } + + // // XMLDocumentScanner methods // @@ -547,7 +567,7 @@ // flush possible pending output buffer - see scanContent if (fInScanContent && fStringBuffer.length != 0 && fDocumentHandler != null) { - fDocumentHandler.characters(fStringBuffer, null); + fDocumentHandler.characters(fStringBuffer, null); //ALEK fStringBuffer.length = 0; // make sure we know it's been flushed } @@ -698,6 +718,9 @@ throws IOException, XNIException { if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanStartElement()"); + //ALEK record absolute position of start tag including '<' + recordPosAbsoluteStart("scanStartElement()", -1); //ALEK + // name if (fNamespaces) { fEntityScanner.scanQName(fElementQName); @@ -742,14 +765,17 @@ } while (true); + //ALEK record absolute position of end tag past final '>' + recordPosAbsoluteEnd("scanStartElement()", 0); //ALEK + // call handler if (fDocumentHandler != null) { if (empty) { - fDocumentHandler.emptyElement(fElementQName, fAttributes, null); + fDocumentHandler.emptyElement(fElementQName, fAttributes, fAugmentations); handleEndElement(fElementQName, true); } else { - fDocumentHandler.startElement(fElementQName, fAttributes, null); + fDocumentHandler.startElement(fElementQName, fAttributes, fAugmentations); } } @@ -965,6 +991,9 @@ protected int scanEndElement() throws IOException, XNIException { if (DEBUG_CONTENT_SCANNING) System.out.println(">>> scanEndElement()"); + //ALEK record absolute position of end tag including '' + recordPosAbsoluteEnd("scanEndElement()", 0); //ALEK + // handle end element int depth = handleEndElement(fElementQName, false); if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanEndElement(): "+depth); @@ -1093,7 +1125,8 @@ fSingleChar[0] = c; fString.setValues(fSingleChar, 0, 1); - fDocumentHandler.characters(fString, null); + //fDocumentHandler.characters(fString, null); + fDocumentHandler.characters(fString, fAugmentations); //ALEK CHECK if (fNotifyBuiltInRefs) { fDocumentHandler.endGeneralEntity(entity, null); @@ -1142,7 +1175,7 @@ // call handler if (fDocumentHandler != null && !isEmpty) { - fDocumentHandler.endElement(element, null); + fDocumentHandler.endElement(element, fAugmentations); } return fMarkupDepth; @@ -1403,7 +1436,7 @@ if (scanSurrogates(fStringBuffer)) { // call handler if (fDocumentHandler != null) { - fDocumentHandler.characters(fStringBuffer, null); + fDocumentHandler.characters(fStringBuffer, fAugmentations); //ALEK CHECK } } } Index: src/org/apache/xerces/impl/XMLEntityManager.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java,v retrieving revision 1.25 diff -b -w -u -r1.25 XMLEntityManager.java --- src/org/apache/xerces/impl/XMLEntityManager.java 31 Jan 2002 15:17:56 -0000 1.25 +++ src/org/apache/xerces/impl/XMLEntityManager.java 3 Apr 2002 06:02:06 -0000 @@ -1727,7 +1727,10 @@ /** Count of characters in buffer. */ public int count; - // to allow the reader/nputStream to behave efficiently: + /** Absolute offset since origin of buffer */ + public int offsetZero; //ALEK + + // to allow the reader/inputStream to behave efficiently: public boolean mayReadChunks; // @@ -3154,6 +3157,49 @@ return -1; } // getColumnNumber():int + /** + * Return the position of parser in current entity since its beginning. + * This position is in number of UTF16 characters since beginning of + * reading that entity. + * + * @return The position in UTF16 characters or -1 if none is available. + */ + public int getCurrentEntityAbsoluteOffset() { //ALEK + //return fCurrentEntity != null ? fCurrentEntity.columnNumber : -1; + if (fCurrentEntity != null) { + //if (fCurrentEntity.systemId != null ) { + // return fCurrentEntity.position + fCurrentEntity.offsetZero; + //} + //if (fCurrentEntity.entityLocation != null && + // fCurrentEntity.entityLocation.getExpandedSystemId() != null ) { + if (fCurrentEntity.isExternal()) { + return fCurrentEntity.position + fCurrentEntity.offsetZero; + } + else { + // search for the first external entity on the stack + int size = fEntityStack.size(); + for (int i=size-1; i>0 ; i--) { + //ScannedEntity firstExternalEntity = (ScannedEntity)fEntityStack.elementAt(i); + ScannedEntity firstExternalEntity = (ScannedEntity)fEntityStack.elementAt(i); + + //if (firstExternalEntity.systemId != null) { + // return fCurrentEntity.position + firstExternalEntity.offsetZero; + //} + //if (externalEntity.entityLocation != null && + // externalEntity.entityLocation.getExpandedSystemId() != null) { + if (firstExternalEntity.isExternal()) { + //return firstExternalEntity.columnNumber; + return fCurrentEntity.position + firstExternalEntity.offsetZero; + } + + } + } + } + + return -1; + } // getCurrentEntityAbsoluteOffset():int + + // // Private methods // @@ -3179,6 +3225,8 @@ print(); System.out.println(); } + // update absolute offset for this entity + fCurrentEntity.offsetZero += fCurrentEntity.position - offset; // read characters int length = fCurrentEntity.ch.length - offset; Index: src/org/apache/xerces/impl/XMLNamespaceBinder.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java,v retrieving revision 1.13 diff -b -w -u -r1.13 XMLNamespaceBinder.java --- src/org/apache/xerces/impl/XMLNamespaceBinder.java 23 Jan 2002 15:31:21 -0000 1.13 +++ src/org/apache/xerces/impl/XMLNamespaceBinder.java 3 Apr 2002 06:02:09 -0000 @@ -744,6 +744,7 @@ // check for duplicates prefix = localpart != fXmlnsSymbol ? localpart : fEmptySymbol; String uri = attributes.getValue(i); + if(uri == null) throw new XNIException("internal error: attribute uri can not be null"); uri = fSymbolTable.addSymbol(uri); // http://www.w3.org/TR/1999/REC-xml-names-19990114/#dt-prefix Index: src/org/apache/xerces/impl/XMLScanner.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/XMLScanner.java,v retrieving revision 1.12 diff -b -w -u -r1.12 XMLScanner.java Index: src/org/apache/xerces/impl/xs/util/SimpleLocator.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/xs/util/SimpleLocator.java,v retrieving revision 1.1 diff -b -w -u -r1.1 SimpleLocator.java --- src/org/apache/xerces/impl/xs/util/SimpleLocator.java 18 Feb 2002 22:30:26 -0000 1.1 +++ src/org/apache/xerces/impl/xs/util/SimpleLocator.java 3 Apr 2002 06:02:14 -0000 @@ -108,5 +108,10 @@ public String getBaseSystemId() { return null; + } + + /** Returns the parser position counting sizne beginning of entity input. */ + public int getCurrentEntityAbsoluteOffset() { + return 0; } } Index: src/org/apache/xerces/util/ErrorHandlerWrapper.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/util/ErrorHandlerWrapper.java,v retrieving revision 1.5 diff -b -w -u -r1.5 ErrorHandlerWrapper.java --- src/org/apache/xerces/util/ErrorHandlerWrapper.java 29 Jan 2002 01:15:18 -0000 1.5 +++ src/org/apache/xerces/util/ErrorHandlerWrapper.java 3 Apr 2002 06:02:14 -0000 @@ -250,6 +250,7 @@ public String getLiteralSystemId() { return null; } public int getColumnNumber() { return fColumnNumber; } public int getLineNumber() { return fLineNumber; } + public int getCurrentEntityAbsoluteOffset() { return -1; } }; return new XMLParseException(location, exception.getMessage(), exception.getException()); Index: src/org/apache/xerces/xni/XMLLocator.java =================================================================== RCS file: /home/cvspublic/xml-xerces/java/src/org/apache/xerces/xni/XMLLocator.java,v retrieving revision 1.4 diff -b -w -u -r1.4 XMLLocator.java --- src/org/apache/xerces/xni/XMLLocator.java 29 Jan 2002 01:15:19 -0000 1.4 +++ src/org/apache/xerces/xni/XMLLocator.java 3 Apr 2002 06:02:15 -0000 @@ -77,5 +77,8 @@ /** Returns the column number. */ public int getColumnNumber(); + + /** Returns the parser position counting sizne beginning of entity input. */ + public int getCurrentEntityAbsoluteOffset(); } // interface XMLLocator PullParser2.1.10/lib/xerces2_patched/LICENSE.txt0000644000175000017500000000521207755336265021507 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999-2002 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 "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.ibm.com. For more * information on the Apache Software Foundation, please see * . */ PullParser2.1.10/lib/xerces2_patched/README.txt0000644000175000017500000000064507755336265021367 0ustar wbaerwbaer00000000000000PullParser 2 driver for Xerces 2.0.1 will work with unpatched Xerces 2.0.1 however when this patch is applied the driver will be able to report event positions and will pass all XPP2 internal tests. Apply the included PATCH file or simply use provided patched JAR (it also fixes bug reported to Xerces 2 mailing list that prevents passing XPP2 tests - see patch for src/org/apache/xerces/impl/XMLNamespaceBinder.java) PullParser2.1.10/src/0000755000175000017500000000000007755336254014640 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/etc/0000755000175000017500000000000010232453172015372 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/etc/test_xml/0000755000175000017500000000000007755336261017250 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/etc/soap_env_1.xml0000644000175000017500000000072507755336261020171 0ustar wbaerwbaer00000000000000 DEF DEF Corp 34.1 DEF PullParser2.1.10/src/java/0000755000175000017500000000000007755336254015561 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/0000755000175000017500000000000007755336254016515 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/jaxp11/0000755000175000017500000000000010232453172017600 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/jaxp11/javax/0000755000175000017500000000000007755336257020735 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/jaxp11/javax/xml/0000755000175000017500000000000007755336257021535 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/0000755000175000017500000000000010232453172023170 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/DocumentBuilder.java0000644000175000017500000002515007755336257027147 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; import java.io.InputStream; import java.io.IOException; import java.io.File; import org.xml.sax.Parser; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.w3c.dom.Document; import org.w3c.dom.DOMImplementation; /** * Defines the API to obtain DOM Document instances from an XML * document. Using this class, an application programmer can obtain a * {@link org.w3c.dom.Document} from XML.

    * * An instance of this class can be obtained from the * {@link javax.xml.parsers.DocumentBuilderFactory#newDocumentBuilder() * DocumentBuilderFactory.newDocumentBuilder} method. Once * an instance of this class is obtained, XML can be parsed from a * variety of input sources. These input sources are InputStreams, * Files, URLs, and SAX InputSources.

    * * Note that this class reuses several classes from the SAX API. This * does not require that the implementor of the underlying DOM * implementation use a SAX parser to parse XML document into a * Document. It merely requires that the implementation * communicate with the application using these existing APIs.

    * * An implementation of DocumentBuilder is NOT * guaranteed to behave as per the specification if it is used concurrently by * two or more threads. It is recommended to have one instance of the * DocumentBuilder per thread or it is upto the application to * make sure about the use of DocumentBuilder from more than one * thread. * * @since JAXP 1.0 * @version 1.0 */ public abstract class DocumentBuilder { protected DocumentBuilder () { } /** * Parse the content of the given InputStream as an XML * document and return a new DOM {@link org.w3c.dom.Document} object. * * @param is InputStream containing the content to be parsed. * @exception IOException If any IO errors occur. * @exception SAXException If any parse errors occur. * @exception IllegalArgumentException If the InputStream is null * @see org.xml.sax.DocumentHandler */ public Document parse(InputStream is) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource in = new InputSource(is); return parse(in); } /** * Parse the content of the given InputStream as an XML * document and return a new DOM {@link org.w3c.dom.Document} object. * * @param is InputStream containing the content to be parsed. * @param systemId Provide a base for resolving relative URIs. * @exception IOException If any IO errors occur. * @exception SAXException If any parse errors occur. * @exception IllegalArgumentException If the InputStream is null. * @see org.xml.sax.DocumentHandler * @return A new DOM Document object. */ public Document parse(InputStream is, String systemId) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource in = new InputSource(is); in.setSystemId(systemId); return parse(in); } /** * Parse the content of the given URI as an XML document * and return a new DOM {@link org.w3c.dom.Document} object. * * @param uri The location of the content to be parsed. * @exception IOException If any IO errors occur. * @exception SAXException If any parse errors occur. * @exception IllegalArgumentException If the URI is null. * @see org.xml.sax.DocumentHandler * @return A new DOM Document object. */ public Document parse(String uri) throws SAXException, IOException { if (uri == null) { throw new IllegalArgumentException("URI cannot be null"); } InputSource in = new InputSource(uri); return parse(in); } /** * Parse the content of the given file as an XML document * and return a new DOM {@link org.w3c.dom.Document} object. * * @param f The file containing the XML to parse. * @exception IOException If any IO errors occur. * @exception SAXException If any parse errors occur. * @exception IllegalArgumentException If the file is null. * @see org.xml.sax.DocumentHandler * @return A new DOM Document object. */ public Document parse(File f) throws SAXException, IOException { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } String uri = "file:" + f.getAbsolutePath(); if (File.separatorChar == '\\') { uri = uri.replace('\\', '/'); } InputSource in = new InputSource(uri); return parse(in); } /** * Parse the content of the given input source as an XML document * and return a new DOM {@link org.w3c.dom.Document} object. * * @param is InputSource containing the content to be parsed. * @exception IOException If any IO errors occur. * @exception SAXException If any parse errors occur. * @exception IllegalArgumentException If the InputSource is null. * @see org.xml.sax.DocumentHandler * @return A new DOM Document object. */ public abstract Document parse(InputSource is) throws SAXException, IOException; /** * Indicates whether or not this parser is configured to * understand namespaces. * * @return true if this parser is configured to understand * namespaces; false otherwise. */ public abstract boolean isNamespaceAware(); /** * Indicates whether or not this parser is configured to * validate XML documents. * * @return true if this parser is configured to validate * XML documents; false otherwise. */ public abstract boolean isValidating(); /** * Specify the {@link org.xml.sax.EntityResolver} to be used to resolve * entities present in the XML document to be parsed. Setting * this to null will result in the underlying * implementation using it's own default implementation and * behavior. * * @param er The EntityResolver to be used to resolve entities * present in the XML document to be parsed. */ public abstract void setEntityResolver(org.xml.sax.EntityResolver er); /** * Specify the {@link org.xml.sax.ErrorHandler} to be used to report * errors present in the XML document to be parsed. Setting * this to null will result in the underlying * implementation using it's own default implementation and * behavior. * * @param eh The ErrorHandler to be used to report errors * present in the XML document to be parsed. */ public abstract void setErrorHandler(org.xml.sax.ErrorHandler eh); /** * Obtain a new instance of a DOM {@link org.w3c.dom.Document} object * to build a DOM tree with. An alternative way to create a DOM * Document object is to use the * {@link #getDOMImplementation() getDOMImplementation} * method to get a DOM Level 2 DOMImplementation object and then use * DOM Level 2 methods on that object to create a DOM Document object. * * @return A new instance of a DOM Document object. */ public abstract Document newDocument(); /** * Obtain an instance of a {@link org.w3c.dom.DOMImplementation} object. * * @return A new instance of a DOMImplementation. */ public abstract DOMImplementation getDOMImplementation(); } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/DocumentBuilderFactory.java0000644000175000017500000003174207755336257030503 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; 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; /** * Defines a factory API that enables applications to obtain a * parser that produces DOM object trees from XML documents. * * An implementation of the DocumentBuilderFactory class is * NOT guaranteed to be thread safe. It is up to the user application * to make sure about the use of the DocumentBuilderFactory from * more than one thread. Alternatively the application can have one instance * of the DocumentBuilderFactory per thread. * An application can use the same instance of the factory to obtain one or * more instances of the DocumentBuilder provided the instance * of the factory isn't being used in more than one thread at a time. * * @since JAXP 1.0 * @version 1.0 */ public abstract class DocumentBuilderFactory { private boolean validating = false; private boolean namespaceAware = false; private boolean whitespace = false; private boolean expandEntityRef = true; private boolean ignoreComments = false; private boolean coalescing = false; protected DocumentBuilderFactory () { } /** * Obtain a new instance of a * DocumentBuilderFactory. This static method creates * a new factory instance. * This method uses the following ordered lookup procedure to determine * the DocumentBuilderFactory implementation class to * load: *

      *
    • * Use the javax.xml.parsers.DocumentBuilderFactory system * property. *
    • *
    • * Use the properties file "lib/jaxp.properties" in the JRE directory. * This configuration file is in standard java.util.Properties * format and contains the fully qualified name of the * implementation class with the key being 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/javax.xml.parsers.DocumentBuilderFactory * in jars available to the runtime. *
    • *
    • * Platform default DocumentBuilderFactory instance. *
    • *
    * * Once an application has obtained a reference to a * DocumentBuilderFactory it can use the factory to * configure and obtain parser instances. * * @exception FactoryConfigurationError if the implementation is not * available or cannot be instantiated. */ public static DocumentBuilderFactory newInstance() throws FactoryConfigurationError { try { return (DocumentBuilderFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ "javax.xml.parsers.DocumentBuilderFactory", /* The fallback implementation class name */ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); } } /** * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder} * using the currently configured parameters. * * @exception ParserConfigurationException if a DocumentBuilder * cannot be created which satisfies the configuration requested. * @return A new instance of a DocumentBuilder. */ public abstract DocumentBuilder newDocumentBuilder() throws ParserConfigurationException; /** * Specifies that the parser produced by this code will * provide support for XML namespaces. By default the value of this is set * to false * * @param awareness true if the parser produced will provide support * for XML namespaces; false otherwise. */ public void setNamespaceAware(boolean awareness) { this.namespaceAware = awareness; } /** * Specifies that the parser produced by this code will * validate documents as they are parsed. By default the value of this * is set to false. * * @param validating true if the parser produced will validate documents * as they are parsed; false otherwise. */ public void setValidating(boolean validating) { this.validating = validating; } /** * Specifies that the parsers created by this factory must eliminate * whitespace in element content (sometimes known loosely as * 'ignorable whitespace') when parsing XML documents (see XML Rec * 2.10). Note that only whitespace which is directly contained within * element content that has an element only content model (see XML * Rec 3.2.1) will be eliminated. Due to reliance on the content model * this setting requires the parser to be in validating mode. By default * the value of this is set to false. * * @param whitespace true if the parser created must eliminate whitespace * in the element content when parsing XML documents; * false otherwise. */ public void setIgnoringElementContentWhitespace(boolean whitespace) { this.whitespace = whitespace; } /** * Specifies that the parser produced by this code will * expand entity reference nodes. By default the value of this is set to * true * * @param expandEntityRef true if the parser produced will expand entity * reference nodes; false otherwise. */ public void setExpandEntityReferences(boolean expandEntityRef) { this.expandEntityRef = expandEntityRef; } /** * Specifies that the parser produced by this code will * ignore comments. By default the value of this is set to false * */ public void setIgnoringComments(boolean ignoreComments) { this.ignoreComments = ignoreComments; } /** * Specifies that the parser produced by this code will * convert CDATA nodes to Text nodes and append it to the * adjacent (if any) text node. By default the value of this is set to * false * * @param coalescing true if the parser produced will convert CDATA nodes * to Text nodes and append it to the adjacent (if any) * text node; false otherwise. */ public void setCoalescing(boolean coalescing) { this.coalescing = coalescing; } /** * Indicates whether or not the factory is configured to produce * parsers which are namespace aware. * * @return true if the factory is configured to produce parsers which * are namespace aware; false otherwise. */ public boolean isNamespaceAware() { return namespaceAware; } /** * Indicates whether or not the factory is configured to produce * parsers which validate the XML content during parse. * * @return true if the factory is configured to produce parsers * which validate the XML content during parse; false otherwise. */ public boolean isValidating() { return validating; } /** * Indicates whether or not the factory is configured to produce * parsers which ignore ignorable whitespace in element content. * * @return true if the factory is configured to produce parsers * which ignore ignorable whitespace in element content; * false otherwise. */ public boolean isIgnoringElementContentWhitespace() { return whitespace; } /** * Indicates whether or not the factory is configured to produce * parsers which expand entity reference nodes. * * @return true if the factory is configured to produce parsers * which expand entity reference nodes; false otherwise. */ public boolean isExpandEntityReferences() { return expandEntityRef; } /** * Indicates whether or not the factory is configured to produce * parsers which ignores comments. * * @return true if the factory is configured to produce parsers * which ignores comments; false otherwise. */ public boolean isIgnoringComments() { return ignoreComments; } /** * Indicates whether or not the factory is configured to produce * parsers which converts CDATA nodes to Text nodes and appends it to * the adjacent (if any) Text node. * * @return true if the factory is configured to produce parsers * which converts CDATA nodes to Text nodes and appends it to * the adjacent (if any) Text node; false otherwise. */ public boolean isCoalescing() { return coalescing; } /** * 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. * @exception IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public abstract void setAttribute(String name, Object value) throws IllegalArgumentException; /** * 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. * @exception IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public abstract Object getAttribute(String name) throws IllegalArgumentException; } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/FactoryConfigurationError.java0000644000175000017500000001245507755336257031237 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; /** * Thrown when a problem with configuration with the Parser Factories * exists. This error will typically be thrown when the class of a * parser factory specified in the system properties cannot be found * or instantiated. * * @since JAXP 1.0 * @version 1.0 */ public class FactoryConfigurationError extends Error { private Exception exception; /** * Create a new FactoryConfigurationError with no * detail mesage. */ public FactoryConfigurationError() { super(); this.exception = null; } /** * Create a new FactoryConfigurationError with * the String specified as an error message. * * @param msg The error message for the exception. */ public FactoryConfigurationError(String msg) { super(msg); this.exception = null; } /** * Create a new FactoryConfigurationError with a * given Exception base cause of the error. * * @param e The exception to be encapsulated in a * FactoryConfigurationError. */ public FactoryConfigurationError(Exception e) { super(e.toString()); this.exception = e; } /** * Create a new FactoryConfigurationError with the * given Exception base cause and detail message. * * @param e The exception to be encapsulated in a * FactoryConfigurationError * @param msg The detail message. * @param e The exception to be wrapped in a FactoryConfigurationError */ public FactoryConfigurationError(Exception e, String msg) { super(msg); this.exception = e; } /** * Return the message (if any) for this error . If there is no * message for the exception and there is an encapsulated * exception then the message of that exception, if it exists will be * returned. Else the name of the encapsulated exception will be * returned. * * @return The error message. */ public String getMessage () { String message = super.getMessage (); if (message == null && exception != null) { return exception.getMessage(); } return message; } /** * Return the actual exception (if any) that caused this exception to * be raised. * * @return The encapsulated exception, or null if there is none. */ public Exception getException () { return exception; } } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/FactoryFinder.java0000644000175000017500000002506207755336257026623 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; 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; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; /** * 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 both compile and run on JDK version 1.1 and * later. The code also runs both as part of an unbundled jar file and * when bundled as part of the JDK. */ class FactoryFinder { /** Set to true for debugging */ private static final boolean debug = false; private static void debugPrintln(String msg) { if (debug) { System.err.println("JAXP: " + msg); } } /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ private static ClassLoader findClassLoader() throws ConfigurationError { Method m = null; try { m = Thread.class.getMethod("getContextClassLoader", null); } catch (NoSuchMethodException e) { // Assume that we are running JDK 1.1, use the current ClassLoader debugPrintln("assuming JDK 1.1"); return FactoryFinder.class.getClassLoader(); } try { return (ClassLoader) m.invoke(Thread.currentThread(), null); } catch (IllegalAccessException e) { // assert(false) throw new ConfigurationError("Unexpected IllegalAccessException", e); } catch (InvocationTargetException e) { // assert(e.getTargetException() instanceof SecurityException) throw new ConfigurationError("Unexpected InvocationTargetException", e); } } /** * Create an instance of a class using the specified ClassLoader */ private static Object newInstance(String className, ClassLoader classLoader) throws ConfigurationError { try { Class spiClass; if (classLoader == null) { spiClass = Class.forName(className); } else { spiClass = classLoader.loadClass(className); } return spiClass.newInstance(); } 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); } } /** * Finds the implementation Class object in the specified order. Main * entry point. * @return Class object 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 FactoryFinder.ConfigurationError * * Package private so this code can be shared. */ static Object find(String factoryId, String fallbackClassName) throws ConfigurationError { debugPrintln("debug is on"); ClassLoader classLoader = findClassLoader(); // Use the system property first try { String systemProp = System.getProperty( factoryId ); if( systemProp!=null) { debugPrintln("found system property " + systemProp); return newInstance(systemProp, classLoader); } } catch (SecurityException se) { } // try to read from $java.home/lib/xml.properties try { String javah=System.getProperty( "java.home" ); String configFile = javah + File.separator + "lib" + File.separator + "jaxp.properties"; File f=new File( configFile ); if( f.exists()) { Properties props=new Properties(); props.load( new FileInputStream(f)); String factoryClassName = props.getProperty(factoryId); debugPrintln("found java.home property " + factoryClassName); return newInstance(factoryClassName, classLoader); } } catch(Exception ex ) { if( debug ) ex.printStackTrace(); } String serviceId = "META-INF/services/" + factoryId; // try to find services in CLASSPATH try { InputStream is=null; if (classLoader == null) { is=ClassLoader.getSystemResourceAsStream( serviceId ); } else { is=classLoader.getResourceAsStream( serviceId ); } if( is!=null ) { debugPrintln("found " + serviceId); // 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 = rd.readLine(); rd.close(); if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("loaded from services: " + factoryClassName); return newInstance(factoryClassName, classLoader); } } } catch( Exception ex ) { if( debug ) ex.printStackTrace(); } if (fallbackClassName == null) { throw new ConfigurationError( "Provider for " + factoryId + " cannot be found", null); } debugPrintln("loaded from fallback value: " + fallbackClassName); return newInstance(fallbackClassName, classLoader); } static class ConfigurationError extends Error { private Exception exception; /** * Construct a new instance with the specified detail string and * exception. */ ConfigurationError(String msg, Exception x) { super(msg); this.exception = x; } Exception getException() { return exception; } } } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/package.html0000644000175000017500000000033707755336265025477 0ustar wbaerwbaer00000000000000 Provides classes allowing the processing of XML documents. Two types of plugable parsers are supported:
    • SAX (Simple API for XML)
    • DOM (Document Object Model)
    PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/ParserConfigurationException.java0000644000175000017500000000651307755336257031727 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; /** * Indicates a serious configuration error. * * @since JAXP 1.0 * @version 1.0 */ public class ParserConfigurationException extends Exception { /** * Create a new ParserConfigurationException with no * detail mesage. */ public ParserConfigurationException() { super(); } /** * Create a new ParserConfigurationException with * the String specified as an error message. * * @param msg The error message for the exception. */ public ParserConfigurationException(String msg) { super(msg); } } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/SAXParser.java0000644000175000017500000004356607755336257025705 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; import java.io.InputStream; import java.io.IOException; import java.io.File; import org.xml.sax.Parser; import org.xml.sax.XMLReader; import org.xml.sax.HandlerBase; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; /** * Defines the API that wraps an {@link org.xml.sax.XMLReader} * implementation class. In JAXP 1.0, this class wrapped the * {@link org.xml.sax.Parser} interface, however this interface was * replaced by the {@link org.xml.sax.XMLReader}. For ease * of transition, this class continues to support the same name * and interface as well as supporting new methods. * * An instance of this class can be obtained from the * {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method. * Once an instance of this class is obtained, XML can be parsed from * a variety of input sources. These input sources are InputStreams, * Files, URLs, and SAX InputSources.

    * * * As the content is parsed by the underlying parser, methods of the * given {@link org.xml.sax.HandlerBase} or the * {@link org.xml.sax.helpers.DefaultHandler} are called.

    * * Implementors of this class which wrap an underlying implementation * can consider using the {@link org.xml.sax.helpers.ParserAdapter} * class to initially adapt their SAX1 impelemntation to work under * this revised class.

    * * An implementation of SAXParser is NOT * guaranteed to behave as per the specification if it is used concurrently by * two or more threads. It is recommended to have one instance of the * SAXParser per thread or it is upto the application to * make sure about the use of SAXParser from more than one * thread. * * @since JAXP 1.0 * @version 1.0 */ public abstract class SAXParser { protected SAXParser () { } /** * Parse the content of the given {@link java.io.InputStream} * instance as XML using the specified {@link org.xml.sax.HandlerBase}. * Use of the DefaultHandler version of this method is recommended as * the HandlerBase class has been deprecated in SAX 2.0 * * @param is InputStream containing the content to be parsed. * @param hb The SAX HandlerBase to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the given InputStream is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(InputStream is, HandlerBase hb) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource input = new InputSource(is); this.parse(input, hb); } /** * Parse the content of the given {@link java.io.InputStream} * instance as XML using the specified {@link org.xml.sax.HandlerBase}. * Use of the DefaultHandler version of this method is recommended as * the HandlerBase class has been deprecated in SAX 2.0 * * @param is InputStream containing the content to be parsed. * @param hb The SAX HandlerBase to use. * @param systemId The systemId which is needed for resolving relative URIs. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the given InputStream is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler * version of this method instead. */ public void parse(InputStream is, HandlerBase hb, String systemId) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource input = new InputSource(is); input.setSystemId(systemId); this.parse(input, hb); } /** * Parse the content of the given {@link java.io.InputStream} * instance as XML using the specified * {@link org.xml.sax.helpers.DefaultHandler}. * * @param is InputStream containing the content to be parsed. * @param dh The SAX DefaultHandler to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the given InputStream is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(InputStream is, DefaultHandler dh) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource input = new InputSource(is); this.parse(input, dh); } /** * Parse the content of the given {@link java.io.InputStream} * instance as XML using the specified * {@link org.xml.sax.helpers.DefaultHandler}. * * @param is InputStream containing the content to be parsed. * @param dh The SAX DefaultHandler to use. * @param systemId The systemId which is needed for resolving relative URIs. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the given InputStream is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler * version of this method instead. */ public void parse(InputStream is, DefaultHandler dh, String systemId) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputStream cannot be null"); } InputSource input = new InputSource(is); input.setSystemId(systemId); this.parse(input, dh); } /** * Parse the content described by the giving Uniform Resource * Identifier (URI) as XML using the specified * {@link org.xml.sax.HandlerBase}. * Use of the DefaultHandler version of this method is recommended as * the HandlerBase class has been deprecated in SAX 2.0 * * @param uri The location of the content to be parsed. * @param hb The SAX HandlerBase to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the uri is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(String uri, HandlerBase hb) throws SAXException, IOException { if (uri == null) { throw new IllegalArgumentException("uri cannot be null"); } InputSource input = new InputSource(uri); this.parse(input, hb); } /** * Parse the content described by the giving Uniform Resource * Identifier (URI) as XML using the specified * {@link org.xml.sax.helpers.DefaultHandler}. * * @param uri The location of the content to be parsed. * @param dh The SAX DefaultHandler to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the uri is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(String uri, DefaultHandler dh) throws SAXException, IOException { if (uri == null) { throw new IllegalArgumentException("uri cannot be null"); } InputSource input = new InputSource(uri); this.parse(input, dh); } /** * Parse the content of the file specified as XML using the * specified {@link org.xml.sax.HandlerBase}. * Use of the DefaultHandler version of this method is recommended as * the HandlerBase class has been deprecated in SAX 2.0 * * @param f The file containing the XML to parse * @param hb The SAX HandlerBase to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the File object is null. * @see org.xml.sax.DocumentHandler * @exception SAXException If the underlying parser throws a * SAXException while parsing. */ public void parse(File f, HandlerBase hb) throws SAXException, IOException { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } String uri = "file:" + f.getAbsolutePath(); if (File.separatorChar == '\\') { uri = uri.replace('\\', '/'); } InputSource input = new InputSource(uri); this.parse(input, hb); } /** * Parse the content of the file specified as XML using the * specified {@link org.xml.sax.helpers.DefaultHandler}. * * @param f The file containing the XML to parse * @param dh The SAX DefaultHandler to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the File object is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(File f, DefaultHandler dh) throws SAXException, IOException { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } String uri = "file:" + f.getAbsolutePath(); if (File.separatorChar == '\\') { uri = uri.replace('\\', '/'); } InputSource input = new InputSource(uri); this.parse(input, dh); } /** * Parse the content given {@link org.xml.sax.InputSource} * as XML using the specified * {@link org.xml.sax.HandlerBase}. * Use of the DefaultHandler version of this method is recommended as * the HandlerBase class has been deprecated in SAX 2.0 * * @param is The InputSource containing the content to be parsed. * @param hb The SAX HandlerBase to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the InputSource is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(InputSource is, HandlerBase hb) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputSource cannot be null"); } Parser parser = this.getParser(); if (hb != null) { parser.setDocumentHandler(hb); parser.setEntityResolver(hb); parser.setErrorHandler(hb); parser.setDTDHandler(hb); } parser.parse(is); } /** * Parse the content given {@link org.xml.sax.InputSource} * as XML using the specified * {@link org.xml.sax.helpers.DefaultHandler}. * * @param is The InputSource containing the content to be parsed. * @param dh The SAX DefaultHandler to use. * @exception IOException If any IO errors occur. * @exception IllegalArgumentException If the InputSource is null. * @exception SAXException If the underlying parser throws a * SAXException while parsing. * @see org.xml.sax.DocumentHandler */ public void parse(InputSource is, DefaultHandler dh) throws SAXException, IOException { if (is == null) { throw new IllegalArgumentException("InputSource cannot be null"); } XMLReader reader = this.getXMLReader(); if (dh != null) { reader.setContentHandler(dh); reader.setEntityResolver(dh); reader.setErrorHandler(dh); reader.setDTDHandler(dh); } reader.parse(is); } /** * Returns the SAX parser that is encapsultated by the * implementation of this class. * * @return The SAX parser that is encapsultated by the * implementation of this class. */ public abstract org.xml.sax.Parser getParser() throws SAXException; /** * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the * implementation of this class. * * @return The XMLReader that is encapsulated by the * implementation of this class. */ public abstract org.xml.sax.XMLReader getXMLReader() throws SAXException; /** * Indicates whether or not this parser is configured to * understand namespaces. * * @return true if this parser is configured to * understand namespaces; false otherwise. */ public abstract boolean isNamespaceAware(); /** * Indicates whether or not this parser is configured to * validate XML documents. * * @return true if this parser is configured to * validate XML documents; false otherwise. */ public abstract boolean isValidating(); /** * Sets the particular property in the underlying implementation of * {@link org.xml.sax.XMLReader}. * A list of the core features and properties can be found at * http://www.megginson.com/SAX/Java/features.html * * @param name The name of the property to be set. * @param value The value of the property to be set. * @exception SAXNotRecognizedException When the underlying XMLReader does * not recognize the property name. * * @exception SAXNotSupportedException When the underlying XMLReader * recognizes the property name but doesn't support the * property. * * @see org.xml.sax.XMLReader#setProperty */ public abstract void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException; /** * * Returns the particular property requested for in the underlying * implementation of {@link org.xml.sax.XMLReader}. * * @param name The name of the property to be retrieved. * @return Value of the requested property. * * @exception SAXNotRecognizedException When the underlying XMLReader does * not recognize the property name. * * @exception SAXNotSupportedException When the underlying XMLReader * recognizes the property name but doesn't support the * property. * * @see org.xml.sax.XMLReader#getProperty */ public abstract Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException; } PullParser2.1.10/src/java/apis/jaxp11/javax/xml/parsers/SAXParserFactory.java0000644000175000017500000002353607755336257027230 0ustar wbaerwbaer00000000000000/* * The Apache Software License, Version 1.1 * * * 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 name "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-2001, Sun Microsystems, * Inc., http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ package javax.xml.parsers; import org.xml.sax.Parser; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; /** * Defines a factory API that enables applications to configure and * obtain a SAX based parser to parse XML documents.

    * An implementation of the SAXParserFactory class is * NOT guaranteed to be thread safe. It is up to the user application * to make sure about the use of the SAXParserFactory from * more than one thread. Alternatively the application can have one instance * of the SAXParserFactory per thread. * An application can use the same instance of the factory to obtain one or * more instances of the SAXParser provided the instance * of the factory isn't being used in more than one thread at a time. *

    * * The static newInstance method returns a new concrete * implementation of this class. * * @since JAXP 1.0 * @version 1.0 */ public abstract class SAXParserFactory { private boolean validating = false; private boolean namespaceAware= false; protected SAXParserFactory () { } /** * Obtain a new instance of a SAXParserFactory. This * static method creates a new factory instance * This method uses the following ordered lookup procedure to determine * the SAXParserFactory implementation class to * load: *

      *
    • * Use the javax.xml.parsers.SAXParserFactory system * property. *
    • *
    • * Use the properties file "lib/jaxp.properties" in the JRE directory. * This configuration file is in standard java.util.Properties * format and contains the fully qualified name of the * implementation class with the key being 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/javax.xml.parsers.SAXParserFactory * in jars available to the runtime. *
    • *
    • * Platform default SAXParserFactory instance. *
    • *
    * * Once an application has obtained a reference to a * SAXParserFactory it can use the factory to * configure and obtain parser instances. * * @return A new instance of a SAXParserFactory. * * @exception FactoryConfigurationError if the implementation is * not available or cannot be instantiated. */ public static SAXParserFactory newInstance() throws FactoryConfigurationError { try { return (SAXParserFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ "javax.xml.parsers.SAXParserFactory", /* The fallback implementation class name */ "org.apache.xerces.jaxp.SAXParserFactoryImpl"); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); } } /** * Creates a new instance of a SAXParser using the currently * configured factory parameters. * * @return A new instance of a SAXParser. * * @exception ParserConfigurationException if a parser cannot * be created which satisfies the requested configuration. */ public abstract SAXParser newSAXParser() throws ParserConfigurationException, SAXException; /** * Specifies that the parser produced by this code will * provide support for XML namespaces. By default the value of this is set * to false. * * @param awareness true if the parser produced by this code will * provide support for XML namespaces; false otherwise. */ public void setNamespaceAware(boolean awareness) { this.namespaceAware = awareness; } /** * Specifies that the parser produced by this code will * validate documents as they are parsed. By default the value of this is * set to false. * * @param validating true if the parser produced by this code will * validate documents as they are parsed; false otherwise. */ public void setValidating(boolean validating) { this.validating = validating; } /** * Indicates whether or not the factory is configured to produce * parsers which are namespace aware. * * @return true if the factory is configured to produce * parsers which are namespace aware; false otherwise. */ public boolean isNamespaceAware() { return namespaceAware; } /** * Indicates whether or not the factory is configured to produce * parsers which validate the XML content during parse. * * @return true if the factory is configured to produce parsers which validate * the XML content during parse; false otherwise. */ public boolean isValidating() { return validating; } /** * * Sets the particular feature in the underlying implementation of * org.xml.sax.XMLReader. * A list of the core features and properties can be found at * http://www.megginson.com/SAX/Java/features.html * * @param name The name of the feature to be set. * @param value The value of the feature to be set. * @exception SAXNotRecognizedException When the underlying XMLReader does * not recognize the property name. * * @exception SAXNotSupportedException When the underlying XMLReader * recognizes the property name but doesn't support the * property. * * @see org.xml.sax.XMLReader#setFeature */ public abstract void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException; /** * * Returns the particular property requested for in the underlying * implementation of org.xml.sax.XMLReader. * * @param name The name of the property to be retrieved. * @return Value of the requested property. * * @exception SAXNotRecognizedException When the underlying XMLReader does * not recognize the property name. * * @exception SAXNotSupportedException When the underlying XMLReader * recognizes the property name but doesn't support the * property. * * @see org.xml.sax.XMLReader#getProperty */ public abstract boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException; } PullParser2.1.10/src/java/apis/jaxp11/README.txt0000644000175000017500000000005607755336265021322 0ustar wbaerwbaer00000000000000JAXP11 based on verion included in Xerces2 PullParser2.1.10/src/java/apis/sax2/0000755000175000017500000000000010232453172017351 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/0000755000175000017500000000000007755336257020164 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/xml/0000755000175000017500000000000007755336257020764 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/xml/sax/0000755000175000017500000000000010232453172021533 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ext/0000755000175000017500000000000010232453172022333 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ext/DeclHandler.java0000644000175000017500000001307307755336257025373 0ustar wbaerwbaer00000000000000// DeclHandler.java - Optional handler for DTD declaration events. // http://www.saxproject.org // Public Domain: no warranty. // $Id: DeclHandler.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.ext; import org.xml.sax.SAXException; /** * SAX2 extension handler for DTD declaration events. * *
    * 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. *
    * *

    This is an optional extension handler for SAX2 to provide more * complete information about DTD declarations in an XML document. * XML readers are not required to recognize this handler, and it * is not part of core-only SAX2 distributions.

    * *

    Note that data-related DTD declarations (unparsed entities and * notations) are already reported through the {@link * org.xml.sax.DTDHandler DTDHandler} interface.

    * *

    If you are using the declaration handler together with a lexical * handler, all of the events will occur between the * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.

    * *

    To set the DeclHandler for an XML reader, use the * {@link org.xml.sax.XMLReader#setProperty setProperty} method * with the property name * http://xml.org/sax/properties/declaration-handler * and an object implementing this interface (or null) as the value. * If the reader does not report declaration events, it will throw a * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException} * when you attempt to register the handler.

    * * @since SAX 2.0 (extensions 1.0) * @author David Megginson * @version 2.0r2pre3 */ public interface 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 parameter entities are fully resolved and all whitespace * is removed,and will include the enclosing parentheses. Other * normalization (such as removing redundant parentheses or * simplifying occurrence indicators) is at the discretion of the * parser.

    * * @param name The element type name. * @param model The content model as a normalized string. * @exception SAXException The application may raise an exception. */ public abstract void elementDecl (String name, String model) throws SAXException; /** * 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", a parenthesized token group with * the separator "|" and all whitespace removed, or the word * "NOTATION" followed by a space followed by a parenthesized * token group with all whitespace removed.

    * *

    The value will be the value as reported to applications, * appropriately normalized and with entity and character * references expanded.

    * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. * @param mode A string representing the attribute defaulting mode * ("#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 abstract void attributeDecl (String eName, String aName, String type, String mode, String value) throws SAXException; /** * Report an internal entity declaration. * *

    Only the effective (first) declaration for each entity * will be reported. All parameter entities in the value * will be expanded, but general entities will not.

    * * @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 abstract void internalEntityDecl (String name, String value) throws SAXException; /** * 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 abstract void externalEntityDecl (String name, String publicId, String systemId) throws SAXException; } // end of DeclHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ext/LexicalHandler.java0000644000175000017500000002004207755336260026071 0ustar wbaerwbaer00000000000000// LexicalHandler.java - optional handler for lexical parse events. // http://www.saxproject.org // Public Domain: no warranty. // $Id: LexicalHandler.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.ext; import org.xml.sax.SAXException; /** * SAX2 extension handler for lexical events. * *
    * 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. *
    * *

    This is an optional extension handler for SAX2 to provide * lexical information about an XML document, such as comments * and CDATA section boundaries. * XML readers are not required to recognize this handler, and it * is not part of core-only SAX2 distributions.

    * *

    The events in the lexical handler apply to the entire document, * not just to the document element, and all lexical handler events * must appear between the content handler's startDocument and * endDocument events.

    * *

    To set the LexicalHandler for an XML reader, use the * {@link org.xml.sax.XMLReader#setProperty setProperty} method * with the property name * http://xml.org/sax/properties/lexical-handler * and an object implementing this interface (or null) as the value. * If the reader does not report lexical events, it will throw a * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException} * when you attempt to register the handler.

    * * @since SAX 2.0 (extensions 1.0) * @author David Megginson * @version 2.0r2pre3 */ public interface LexicalHandler { /** * Report the start of DTD declarations, if any. * *

    This method is intended to report the beginning of the * DOCTYPE declaration; if the document has no DOCTYPE declaration, * this method will not be invoked.

    * *

    All declarations reported through * {@link org.xml.sax.DTDHandler DTDHandler} or * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear * between the startDTD and {@link #endDTD endDTD} events. * Declarations are assumed to belong to the internal DTD subset * unless they appear between {@link #startEntity startEntity} * and {@link #endEntity endEntity} events. Comments and * processing instructions from the DTD should also be reported * between the startDTD and endDTD events, in their original * order of (logical) occurrence; they are not required to * appear in their correct locations relative to DTDHandler * or DeclHandler events, however.

    * *

    Note that the start/endDTD events will appear within * the start/endDocument events from ContentHandler and * before the first * {@link org.xml.sax.ContentHandler#startElement 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. * (Note that this is not resolved against the document * base URI.) * @exception SAXException The application may raise an * exception. * @see #endDTD * @see #startEntity */ public abstract void startDTD (String name, String publicId, String systemId) throws SAXException; /** * Report the end of DTD declarations. * *

    This method is intended to report the end of the * DOCTYPE declaration; if the document has no DOCTYPE declaration, * this method will not be invoked.

    * * @exception SAXException The application may raise an exception. * @see #startDTD */ public abstract void endDTD () throws SAXException; /** * Report the beginning of some internal and external XML entities. * *

    The reporting of parameter entities (including * the external DTD subset) is optional, and SAX2 drivers that * report LexicalHandler events may not implement it; you can use the * http://xml.org/sax/features/lexical-handler/parameter-entities * feature to query or control the reporting of parameter entities.

    * *

    General entities are reported with their regular names, * parameter entities have '%' prepended to their names, and * the external DTD subset has the pseudo-entity name "[dtd]".

    * *

    When a SAX2 driver is providing these events, all other * events must be properly nested within start/end entity * events. There is no additional requirement that events from * {@link org.xml.sax.ext.DeclHandler DeclHandler} or * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.

    * *

    Note that skipped entities will be reported through the * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} * event, which is part of the ContentHandler interface.

    * *

    Because of the streaming event model that SAX uses, some * entity boundaries cannot be reported under any * circumstances:

    * *
      *
    • general entities within attribute values
    • *
    • parameter entities within declarations
    • *
    * *

    These will be silently expanded, with no indication of where * the original entity boundaries were.

    * *

    Note also that the boundaries of character references (which * are not really entities anyway) are not reported.

    * *

    All start/endEntity events must be properly nested. * * @param name The name of the entity. If it is a parameter * entity, the name will begin with '%', and if it is the * external DTD subset, it will be "[dtd]". * @exception SAXException The application may raise an exception. * @see #endEntity * @see org.xml.sax.ext.DeclHandler#internalEntityDecl * @see org.xml.sax.ext.DeclHandler#externalEntityDecl */ public abstract void startEntity (String name) throws SAXException; /** * Report the end of an entity. * * @param name The name of the entity that is ending. * @exception SAXException The application may raise an exception. * @see #startEntity */ public abstract void endEntity (String name) throws SAXException; /** * 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; this event is intended only to report * the boundary.

    * * @exception SAXException The application may raise an exception. * @see #endCDATA */ public abstract void startCDATA () throws SAXException; /** * Report the end of a CDATA section. * * @exception SAXException The application may raise an exception. * @see #startCDATA */ public abstract void endCDATA () throws SAXException; /** * 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). Comments in the DTD must be properly * nested inside start/endDTD and start/endEntity events (if * used).

    * * @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. * @exception SAXException The application may raise an exception. */ public abstract void comment (char ch[], int start, int length) throws SAXException; } // end of LexicalHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ext/package.html0000644000175000017500000000330407755336257024640 0ustar wbaerwbaer00000000000000

    This package contains interfaces to optional SAX2 handlers.

    See http://www.saxproject.org for more information about SAX.

    The package is independent of the SAX2 core, though the functionality exposed generally needs to be implemented within a parser. That independence has several consequences:

    • SAX2 drivers are not required to recognize these handlers, and you cannot assume that the class files will be present in every SAX2 installation.
    • This package may be updated independently of SAX2 (i.e. new handlers may be added without updating SAX2 itself).
    • The handlers are not implemented by the SAX2 org.xml.sax.helpers.DefaultHandler or org.xml.sax.helpers.XMLFilterImpl classes. You can subclass these if you need such behaviour.
    • The handlers need to be registered differently than regular SAX2 handlers.

    This package, SAX2-ext, is a standardized extension to SAX2. It is designed both to allow SAX parsers to pass certain types of information to applications, and to serve as a simple model for other SAX2 parser extension packages. Not all such extension packages should need to be recognized directly by parsers, however. As an example, most schema systems can be cleanly layered on top of parsers supporting the standardized SAX2 interfaces.

    NOTE: this package alone does add any functionality; it simply provides optional interfaces for SAX2 drivers to use. You must use a SAX2 driver that recognizes these interfaces if you actually want to have access to lexical and declaration information.

    PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/0000755000175000017500000000000010232453172023175 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/AttributeListImpl.java0000644000175000017500000002166007755336260027504 0ustar wbaerwbaer00000000000000// SAX default implementation for AttributeList. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: AttributeListImpl.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import org.xml.sax.AttributeList; import java.util.Vector; /** * Default implementation for AttributeList. * *
    * 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. *
    * *

    AttributeList implements the deprecated SAX1 {@link * org.xml.sax.AttributeList AttributeList} interface, and has been * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl * AttributesImpl} interface.

    * *

    This class provides a convenience implementation of the SAX * {@link org.xml.sax.AttributeList AttributeList} interface. This * implementation is useful both for SAX parser writers, who can use * it to provide attributes to the application, and for SAX application * writers, who can use it to create a persistent copy of an element's * attribute specifications:

    * *
     * private AttributeList myatts;
     *
     * public void startElement (String name, AttributeList atts)
     * {
     *              // create a persistent copy of the attribute list
     *              // for use outside this method
     *   myatts = new AttributeListImpl(atts);
     *   [...]
     * }
     * 
    * *

    Please note that SAX parsers are not required to use this * class to provide an implementation of AttributeList; it is * supplied only as an optional convenience. In particular, * parser writers are encouraged to invent more efficient * implementations.

    * * @deprecated This class implements a deprecated interface, * {@link org.xml.sax.AttributeList AttributeList}; * that interface has been replaced by * {@link org.xml.sax.Attributes Attributes}, * which is implemented in the * {@link org.xml.sax.helpers.AttributesImpl * AttributesImpl} helper class. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.AttributeList * @see org.xml.sax.DocumentHandler#startElement */ public class AttributeListImpl implements AttributeList { /** * Create an empty attribute list. * *

    This constructor is most useful for parser writers, who * will use it to create a single, reusable attribute list that * can be reset with the clear method between elements.

    * * @see #addAttribute * @see #clear */ public AttributeListImpl () { } /** * Construct a persistent copy of an existing attribute list. * *

    This constructor is most useful for application writers, * who will use it to create a persistent copy of an existing * attribute list.

    * * @param atts The attribute list to copy * @see org.xml.sax.DocumentHandler#startElement */ public AttributeListImpl (AttributeList atts) { setAttributeList(atts); } //////////////////////////////////////////////////////////////////// // Methods specific to this class. //////////////////////////////////////////////////////////////////// /** * Set the attribute list, discarding previous contents. * *

    This method allows an application writer to reuse an * attribute list easily.

    * * @param atts The attribute list to copy. */ public void setAttributeList (AttributeList atts) { int count = atts.getLength(); clear(); for (int i = 0; i < count; i++) { addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i)); } } /** * Add an attribute to an attribute list. * *

    This method is provided for SAX parser writers, to allow them * to build up an attribute list incrementally before delivering * it to the application.

    * * @param name The attribute name. * @param type The attribute type ("NMTOKEN" for an enumeration). * @param value The attribute value (must not be null). * @see #removeAttribute * @see org.xml.sax.DocumentHandler#startElement */ public void addAttribute (String name, String type, String value) { names.addElement(name); types.addElement(type); values.addElement(value); } /** * Remove an attribute from the list. * *

    SAX application writers can use this method to filter an * attribute out of an AttributeList. Note that invoking this * method will change the length of the attribute list and * some of the attribute's indices.

    * *

    If the requested attribute is not in the list, this is * a no-op.

    * * @param name The attribute name. * @see #addAttribute */ public void removeAttribute (String name) { int i = names.indexOf(name); if (i >= 0) { names.removeElementAt(i); types.removeElementAt(i); values.removeElementAt(i); } } /** * Clear the attribute list. * *

    SAX parser writers can use this method to reset the attribute * list between DocumentHandler.startElement events. Normally, * it will make sense to reuse the same AttributeListImpl object * rather than allocating a new one each time.

    * * @see org.xml.sax.DocumentHandler#startElement */ public void clear () { names.removeAllElements(); types.removeAllElements(); values.removeAllElements(); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.AttributeList //////////////////////////////////////////////////////////////////// /** * Return the number of attributes in the list. * * @return The number of attributes in the list. * @see org.xml.sax.AttributeList#getLength */ public int getLength () { return names.size(); } /** * Get the name of an attribute (by position). * * @param i The position of the attribute in the list. * @return The attribute name as a string, or null if there * is no attribute at that position. * @see org.xml.sax.AttributeList#getName(int) */ public String getName (int i) { if (i < 0) { return null; } try { return (String)names.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { return null; } } /** * Get the type of an attribute (by position). * * @param i The position of the attribute in the list. * @return The attribute type as a string ("NMTOKEN" for an * enumeration, and "CDATA" if no declaration was * read), or null if there is no attribute at * that position. * @see org.xml.sax.AttributeList#getType(int) */ public String getType (int i) { if (i < 0) { return null; } try { return (String)types.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { return null; } } /** * Get the value of an attribute (by position). * * @param i The position of the attribute in the list. * @return The attribute value as a string, or null if * there is no attribute at that position. * @see org.xml.sax.AttributeList#getValue(int) */ public String getValue (int i) { if (i < 0) { return null; } try { return (String)values.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { return null; } } /** * Get the type of an attribute (by name). * * @param name The attribute name. * @return The attribute type as a string ("NMTOKEN" for an * enumeration, and "CDATA" if no declaration was * read). * @see org.xml.sax.AttributeList#getType(java.lang.String) */ public String getType (String name) { return getType(names.indexOf(name)); } /** * Get the value of an attribute (by name). * * @param name The attribute name. * @see org.xml.sax.AttributeList#getValue(java.lang.String) */ public String getValue (String name) { return getValue(names.indexOf(name)); } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// Vector names = new Vector(); Vector types = new Vector(); Vector values = new Vector(); } // end of AttributeListImpl.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/AttributesImpl.java0000644000175000017500000004226407755336260027036 0ustar wbaerwbaer00000000000000// AttributesImpl.java - default implementation of Attributes. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: AttributesImpl.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import org.xml.sax.Attributes; /** * Default implementation of the Attributes interface. * *
    * 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. *
    * *

    This class provides a default implementation of the SAX2 * {@link org.xml.sax.Attributes Attributes} interface, with the * addition of manipulators so that the list can be modified or * reused.

    * *

    There are two typical uses of this class:

    * *
      *
    1. to take a persistent snapshot of an Attributes object * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or
    2. *
    3. to construct or modify an Attributes object in a SAX2 driver or filter.
    4. *
    * *

    This class replaces the now-deprecated SAX1 {@link * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} * class; in addition to supporting the updated Attributes * interface rather than the deprecated {@link org.xml.sax.AttributeList * AttributeList} interface, it also includes a much more efficient * implementation using a single array rather than a set of Vectors.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 */ public class AttributesImpl implements Attributes { //////////////////////////////////////////////////////////////////// // Constructors. //////////////////////////////////////////////////////////////////// /** * Construct a new, empty AttributesImpl object. */ public AttributesImpl () { length = 0; data = null; } /** * Copy an existing Attributes object. * *

    This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.

    * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.Attributes. //////////////////////////////////////////////////////////////////// /** * Return the number of attributes in the list. * * @return The number of attributes in the list. * @see org.xml.sax.Attributes#getLength */ public int getLength () { return length; } /** * Return an attribute's Namespace URI. * * @param index The attribute's index (zero-based). * @return The Namespace URI, the empty string if none is * available, or null if the index is out of range. * @see org.xml.sax.Attributes#getURI */ public String getURI (int index) { if (index >= 0 && index < length) { return data[index*5]; } else { return null; } } /** * Return an attribute's local name. * * @param index The attribute's index (zero-based). * @return The attribute's local name, the empty string if * none is available, or null if the index if out of range. * @see org.xml.sax.Attributes#getLocalName */ public String getLocalName (int index) { if (index >= 0 && index < length) { return data[index*5+1]; } else { return null; } } /** * Return an attribute's qualified (prefixed) name. * * @param index The attribute's index (zero-based). * @return The attribute's qualified name, the empty string if * none is available, or null if the index is out of bounds. * @see org.xml.sax.Attributes#getQName */ public String getQName (int index) { if (index >= 0 && index < length) { return data[index*5+2]; } else { return null; } } /** * Return an attribute's type by index. * * @param index The attribute's index (zero-based). * @return The attribute's type, "CDATA" if the type is unknown, or null * if the index is out of bounds. * @see org.xml.sax.Attributes#getType(int) */ public String getType (int index) { if (index >= 0 && index < length) { return data[index*5+3]; } else { return null; } } /** * Return an attribute's value by index. * * @param index The attribute's index (zero-based). * @return The attribute's value or null if the index is out of bounds. * @see org.xml.sax.Attributes#getValue(int) */ public String getValue (int index) { if (index >= 0 && index < length) { return data[index*5+4]; } else { return null; } } /** * Look up an attribute's index by Namespace name. * *

    In many cases, it will be more efficient to look up the name once and * use the index query methods rather than using the name query methods * repeatedly.

    * * @param uri The attribute's Namespace URI, or the empty * string if none is available. * @param localName The attribute's local name. * @return The attribute's index, or -1 if none matches. * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) */ public int getIndex (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return i / 5; } } return -1; } /** * Look up an attribute's index by qualified (prefixed) name. * * @param qName The qualified name. * @return The attribute's index, or -1 if none matches. * @see org.xml.sax.Attributes#getIndex(java.lang.String) */ public int getIndex (String qName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i+2].equals(qName)) { return i / 5; } } return -1; } /** * Look up an attribute's type by Namespace-qualified name. * * @param uri The Namespace URI, or the empty string for a name * with no explicit Namespace URI. * @param localName The local name. * @return The attribute's type, or null if there is no * matching attribute. * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) */ public String getType (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return data[i+3]; } } return null; } /** * Look up an attribute's type by qualified (prefixed) name. * * @param qName The qualified name. * @return The attribute's type, or null if there is no * matching attribute. * @see org.xml.sax.Attributes#getType(java.lang.String) */ public String getType (String qName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i+2].equals(qName)) { return data[i+3]; } } return null; } /** * Look up an attribute's value by Namespace-qualified name. * * @param uri The Namespace URI, or the empty string for a name * with no explicit Namespace URI. * @param localName The local name. * @return The attribute's value, or null if there is no * matching attribute. * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) */ public String getValue (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return data[i+4]; } } return null; } /** * Look up an attribute's value by qualified (prefixed) name. * * @param qName The qualified name. * @return The attribute's value, or null if there is no * matching attribute. * @see org.xml.sax.Attributes#getValue(java.lang.String) */ public String getValue (String qName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i+2].equals(qName)) { return data[i+4]; } } return null; } //////////////////////////////////////////////////////////////////// // Manipulators. //////////////////////////////////////////////////////////////////// /** * Clear the attribute list for reuse. * *

    Note that little memory is freed by this call: * the current array is kept so it can be * reused.

    */ public void clear () { if (data != null) { for (int i = 0; i < (length * 5); i++) data [i] = null; } length = 0; } /** * Copy an entire Attributes object. * *

    It may be more efficient to reuse an existing object * rather than constantly allocating new ones.

    * * @param atts The attributes to copy. */ public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); data[i*5+2] = atts.getQName(i); data[i*5+3] = atts.getType(i); data[i*5+4] = atts.getValue(i); } } } /** * 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) { ensureCapacity(length+1); data[length*5] = uri; data[length*5+1] = localName; data[length*5+2] = qName; data[length*5+3] = type; data[length*5+4] = value; length++; } /** * Set an attribute in the list. * *

    For the sake of speed, this method does no checking * for name conflicts or well-formedness: such checks are the * responsibility of the application.

    * * @param index The index of the attribute (zero-based). * @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 name, or the empty string * if qualified names are not available. * @param type The attribute type as a string. * @param value The attribute value. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setAttribute (int index, String uri, String localName, String qName, String type, String value) { if (index >= 0 && index < length) { data[index*5] = uri; data[index*5+1] = localName; data[index*5+2] = qName; data[index*5+3] = type; data[index*5+4] = value; } else { badIndex(index); } } /** * Remove an attribute from the list. * * @param index The index of the attribute (zero-based). * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void removeAttribute (int index) { if (index >= 0 && index < length) { if (index < length - 1) { System.arraycopy(data, (index+1)*5, data, index*5, (length-index-1)*5); } index = (length - 1) * 5; data [index++] = null; data [index++] = null; data [index++] = null; data [index++] = null; data [index] = null; length--; } else { badIndex(index); } } /** * Set the Namespace URI of a specific attribute. * * @param index The index of the attribute (zero-based). * @param uri The attribute's Namespace URI, or the empty * string for none. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setURI (int index, String uri) { if (index >= 0 && index < length) { data[index*5] = uri; } else { badIndex(index); } } /** * Set the local name of a specific attribute. * * @param index The index of the attribute (zero-based). * @param localName The attribute's local name, or the empty * string for none. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; } else { badIndex(index); } } /** * Set the qualified name of a specific attribute. * * @param index The index of the attribute (zero-based). * @param qName The attribute's qualified name, or the empty * string for none. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setQName (int index, String qName) { if (index >= 0 && index < length) { data[index*5+2] = qName; } else { badIndex(index); } } /** * Set the type of a specific attribute. * * @param index The index of the attribute (zero-based). * @param type The attribute's type. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setType (int index, String type) { if (index >= 0 && index < length) { data[index*5+3] = type; } else { badIndex(index); } } /** * Set the value of a specific attribute. * * @param index The index of the attribute (zero-based). * @param value The attribute's value. * @exception java.lang.ArrayIndexOutOfBoundsException When the * supplied index does not point to an attribute * in the list. */ public void setValue (int index, String value) { if (index >= 0 && index < length) { data[index*5+4] = value; } else { badIndex(index); } } //////////////////////////////////////////////////////////////////// // Internal methods. //////////////////////////////////////////////////////////////////// /** * Ensure the internal array's capacity. * * @param n The minimum number of attributes that the array must * be able to hold. */ private void ensureCapacity (int n) { if (n <= 0) { return; } int max; if (data == null || data.length == 0) { max = 25; } else if (data.length >= n * 5) { return; } else { max = data.length; } while (max < n * 5) { max *= 2; } String newData[] = new String[max]; if (length > 0) { System.arraycopy(data, 0, newData, 0, length*5); } data = newData; } /** * Report a bad array index in a manipulator. * * @param index The index to report. * @exception java.lang.ArrayIndexOutOfBoundsException Always. */ private void badIndex (int index) throws ArrayIndexOutOfBoundsException { String msg = "Attempt to modify attribute at illegal index: " + index; throw new ArrayIndexOutOfBoundsException(msg); } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// int length; String data []; } // end of AttributesImpl.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/DefaultHandler.java0000644000175000017500000004061707755336257026756 0ustar wbaerwbaer00000000000000// DefaultHandler.java - default implementation of the core handlers. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: DefaultHandler.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.io.IOException; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.DTDHandler; import org.xml.sax.ContentHandler; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * Default base class for SAX2 event handlers. * *
    * 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. *
    * *

    This class is available as a convenience base class for SAX2 * applications: it provides default implementations for all of the * callbacks in the four core SAX2 handler classes:

    * *
      *
    • {@link org.xml.sax.EntityResolver EntityResolver}
    • *
    • {@link org.xml.sax.DTDHandler DTDHandler}
    • *
    • {@link org.xml.sax.ContentHandler ContentHandler}
    • *
    • {@link org.xml.sax.ErrorHandler ErrorHandler}
    • *
    * *

    Application writers can extend this class when they need to * implement only part of an interface; parser writers can * instantiate this class to provide default handlers when the * application has not supplied its own.

    * *

    This class replaces the deprecated SAX1 * {@link org.xml.sax.HandlerBase HandlerBase} class.

    * * @since SAX 2.0 * @author David Megginson, * @version 2.0r2pre3 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.ContentHandler * @see org.xml.sax.ErrorHandler */ public class DefaultHandler implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler { //////////////////////////////////////////////////////////////////// // Default 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. * @exception java.io.IOException If there is an error setting * up the new input source. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity (String publicId, String systemId) throws IOException, SAXException { return null; } //////////////////////////////////////////////////////////////////// // 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#notationDecl */ 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl (String name, String publicId, String systemId, String notationName) throws SAXException { // no op } //////////////////////////////////////////////////////////////////// // 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) { // no op } /** * 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).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument () throws SAXException { // no op } /** * 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).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument () throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startPrefixMapping */ public void startPrefixMapping (String prefix, String uri) throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping (String prefix) throws SAXException { // no op } /** * 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 atts The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction (String target, String data) throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void skippedEntity (String name) throws SAXException { // no op } //////////////////////////////////////////////////////////////////// // Default 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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; } } // end of DefaultHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/LocatorImpl.java0000644000175000017500000001274407755336257026321 0ustar wbaerwbaer00000000000000// SAX default implementation for Locator. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: LocatorImpl.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import org.xml.sax.Locator; /** * Provide an optional convenience implementation of Locator. * *
    * 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. *
    * *

    This class is available mainly for application writers, who * can use it to make a persistent snapshot of a locator at any * point during a document parse:

    * *
     * Locator locator;
     * Locator startloc;
     *
     * public void setLocator (Locator locator)
     * {
     *         // note the locator
     *   this.locator = locator;
     * }
     *
     * public void startDocument ()
     * {
     *         // save the location of the start of the document
     *         // for future use.
     *   Locator startloc = new LocatorImpl(locator);
     * }
     *
    * *

    Normally, parser writers will not use this class, since it * is more efficient to provide location information only when * requested, rather than constantly updating a Locator object.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.Locator Locator */ public class LocatorImpl implements Locator { /** * Zero-argument constructor. * *

    This will not normally be useful, since the main purpose * of this class is to make a snapshot of an existing Locator.

    */ public LocatorImpl () { } /** * 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 LocatorImpl (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. //////////////////////////////////////////////////////////////////// private String publicId; private String systemId; private int lineNumber; private int columnNumber; } // end of LocatorImpl.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/NamespaceSupport.java0000644000175000017500000005675007755336257027372 0ustar wbaerwbaer00000000000000// NamespaceSupport.java - generic Namespace support for SAX. // http://www.saxproject.org // Written by David Megginson // This class is in the Public Domain. NO WARRANTY! // $Id: NamespaceSupport.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.util.EmptyStackException; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; /** * Encapsulate Namespace logic for use by applications using SAX, * or internally by SAX drivers. * *
    * 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. *
    * *

    This class encapsulates the logic of Namespace processing: * it tracks the declarations currently in force for each context * and automatically processes qualified XML 1.0 names into their * Namespace parts; it can also be used in reverse for generating * XML 1.0 from Namespaces.

    * *

    Namespace support objects are reusable, but the reset method * must be invoked between each session.

    * *

    Here is a simple session:

    * *
     * String parts[] = new String[3];
     * NamespaceSupport support = new NamespaceSupport();
     *
     * support.pushContext();
     * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
     * support.declarePrefix("dc", "http://www.purl.org/dc#");
     *
     * parts = support.processName("p", parts, false);
     * System.out.println("Namespace URI: " + parts[0]);
     * System.out.println("Local name: " + parts[1]);
     * System.out.println("Raw name: " + parts[2]);
     *
     * parts = support.processName("dc:title", parts, false);
     * System.out.println("Namespace URI: " + parts[0]);
     * System.out.println("Local name: " + parts[1]);
     * System.out.println("Raw name: " + parts[2]);
     *
     * support.popContext();
     * 
    * *

    Note that this class is optimized for the use case where most * elements do not contain Namespace declarations: if the same * prefix/URI mapping is repeated for each context (for example), this * class will be somewhat less efficient.

    * *

    Although SAX drivers (parsers) may choose to use this class to * implement namespace handling, they are not required to do so. * Applications must track namespace information themselves if they * want to use namespace information. * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 */ public class NamespaceSupport { //////////////////////////////////////////////////////////////////// // Constants. //////////////////////////////////////////////////////////////////// /** * The XML Namespace URI as a constant. * The value is http://www.w3.org/XML/1998/namespace * as defined in the XML Namespaces specification. * *

    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"; /** * An empty enumeration. */ private final static Enumeration EMPTY_ENUMERATION = new Vector().elements(); //////////////////////////////////////////////////////////////////// // Constructor. //////////////////////////////////////////////////////////////////// /** * Create a new Namespace support object. */ public NamespaceSupport () { 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 () { contexts = new Context[32]; contextPos = 0; contexts[contextPos] = currentContext = new Context(); currentContext.declarePrefix("xml", XMLNS); } /** * Start a new Namespace context. * 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. * *

    Event callback code should start a new context once per element. * This means being ready to call this in either of two places. * For elements that don't include namespace declarations, the * ContentHandler.startElement() callback is the right place. * For elements with such a declaration, it'd done in the first * ContentHandler.startPrefixMapping() callback. * A boolean flag can be used to * track whether a context has been started yet. When either of * those methods is called, it checks the flag to see if a new context * needs to be started. If so, it starts the context and sets the * flag. After ContentHandler.startElement() * does that, it always clears the flag. * *

    Normally, SAX drivers would push a new context at the beginning * of each XML element. Then they perform a first pass over the * attributes to process all namespace declarations, making * ContentHandler.startPrefixMapping() callbacks. * Then a second pass is made, to determine the namespace-qualified * names for all attributes and for the element name. * Finally all the information for the * ContentHandler.startElement() callback is available, * so it can then be made. * *

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

    * * @see org.xml.sax.ContentHandler * @see #popContext */ public void pushContext () { int max = contexts.length; contexts [contextPos].declsOK = false; contextPos++; // Extend the array if necessary if (contextPos >= max) { Context newContexts[] = new Context[max*2]; System.arraycopy(contexts, 0, newContexts, 0, max); max *= 2; contexts = newContexts; } // Allocate the context if necessary. currentContext = contexts[contextPos]; if (currentContext == null) { contexts[contextPos] = currentContext = new Context(); } // Set the parent, if any. if (contextPos > 0) { currentContext.setParent(contexts[contextPos - 1]); } } /** * 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 () { contexts[contextPos].clear(); contextPos--; if (contextPos < 0) { throw new EmptyStackException(); } currentContext = contexts[contextPos]; } //////////////////////////////////////////////////////////////////// // Operations within a context. //////////////////////////////////////////////////////////////////// /** * Declare a Namespace prefix. All prefixes must be declared * before they are referenced. For example, a SAX driver (parser) * would scan an element's attributes * in two passes: first for namespace declarations, * then a second pass using {@link #processName processName()} to * interpret prefixes against (potentially redefined) prefixes. * *

    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 the default element Namespace, use the empty string as * the prefix.

    * *

    Note that you must not declare a prefix after * you've pushed and popped another Namespace context, or * treated the declarations phase as complete by processing * a prefixed name.

    * *

    Note that there is an asymmetry in this library: {@link * #getPrefix getPrefix} will not return the "" prefix, * even if you have declared a default element namespace. * To check for a default namespace, * 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 the empty string to * indicate the default element namespace. This may never have * the value "xml" or "xmlns". * @param uri The Namespace URI to associate with the prefix. * @return true if the prefix was legal, false otherwise * @exception IllegalStateException when a prefix is declared * after looking up a name in the context, or after pushing * another context on top of it. * * @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, after all declarations in the current * context have been handled by {@link #declarePrefix declarePrefix()}. * *

    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 attribute name * will not.

    * * @param qName The raw XML 1.0 name to be processed. * @param parts An 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 myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null; } else { parts[0] = myParts[0]; parts[1] = myParts[1]; parts[2] = myParts[2]; 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. * @param isAttribute true if this prefix is for an attribute * (and the default Namespace is not allowed). * @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) { Vector prefixes = new Vector(); Enumeration allPrefixes = getPrefixes(); while (allPrefixes.hasMoreElements()) { String prefix = (String)allPrefixes.nextElement(); if (uri.equals(getURI(prefix))) { prefixes.addElement(prefix); } } return prefixes.elements(); } /** * 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(); } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private Context contexts[]; private Context currentContext; private int contextPos; //////////////////////////////////////////////////////////////////// // Internal classes. //////////////////////////////////////////////////////////////////// /** * 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). * Also, data structures used to represent contexts are shared when * possible (child contexts without declarations) to further reduce * the amount of memory that's consumed. *

    */ final class Context { /** * Create the root-level Namespace context. */ Context () { copyTables(); } /** * (Re)set the parent of this Namespace context. * The context must either have been freshly constructed, * or must have been cleared. * * @param context The parent Namespace context object. */ void setParent (Context parent) { this.parent = parent; declarations = null; prefixTable = parent.prefixTable; uriTable = parent.uriTable; elementNameTable = parent.elementNameTable; attributeNameTable = parent.attributeNameTable; defaultNS = parent.defaultNS; declSeen = false; declsOK = true; } /** * Makes associated state become collectible, * invalidating this context. * {@link #setParent} must be called before * this context may be used again. */ void clear () { parent = null; prefixTable = null; uriTable = null; elementNameTable = null; attributeNameTable = null; defaultNS = null; } /** * Declare a Namespace prefix for this context. * * @param prefix The prefix to declare. * @param uri The associated Namespace URI. * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix */ void declarePrefix (String prefix, String uri) { // Lazy processing... if (!declsOK) throw new IllegalStateException ( "can't declare any more prefixes in this context"); if (!declSeen) { 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.NamespaceSupport#processName */ String [] processName (String qName, boolean isAttribute) { String name[]; Hashtable table; // detect errors in call sequence declsOK = false; // Select the appropriate table. if (isAttribute) { table = attributeNameTable; } else { table = elementNameTable; } // 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. Maybe in the parent // context, but we can't assume prefix // bindings are the same. name = new String[3]; name[2] = qName.intern(); int index = qName.indexOf(':'); // No prefix. if (index == -1) { if (isAttribute || defaultNS == null) { name[0] = ""; } else { name[0] = defaultNS; } name[1] = name[2]; } // 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(); } // Save in the cache for future use. // (Could be shared with parent context...) table.put(name[2], name); 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.NamespaceSupport#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.NamespaceSupport#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.NamespaceSupport#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.NamespaceSupport#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.

    */ private void copyTables () { if (prefixTable != null) { prefixTable = (Hashtable)prefixTable.clone(); } else { prefixTable = new Hashtable(); } if (uriTable != null) { uriTable = (Hashtable)uriTable.clone(); } else { uriTable = new Hashtable(); } elementNameTable = new Hashtable(); attributeNameTable = new Hashtable(); declSeen = true; } //////////////////////////////////////////////////////////////// // Protected state. //////////////////////////////////////////////////////////////// Hashtable prefixTable; Hashtable uriTable; Hashtable elementNameTable; Hashtable attributeNameTable; String defaultNS = null; boolean declsOK = true; //////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////// private Vector declarations = null; private boolean declSeen = false; private Context parent = null; } } // end of NamespaceSupport.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/NewInstance.java0000644000175000017500000000524707755336260026304 0ustar wbaerwbaer00000000000000// NewInstance.java - create a new instance of a class by name. // http://www.saxproject.org // Written by Edwin Goei, edwingo@apache.org // and by David Brownell, dbrownell@users.sourceforge.net // NO WARRANTY! This class is in the Public Domain. // $Id: NewInstance.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; /** * Create a new instance of a class by name. * *
    * 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. *
    * *

    This class contains a static method for creating an instance of a * class from an explicit class name. It tries to use the thread's context * ClassLoader if possible and falls back to using * Class.forName(String).

    * *

    This code is designed to compile and run on JDK version 1.1 and later * including versions of Java 2.

    * * @author Edwin Goei, David Brownell * @version 2.0r2pre3 */ class NewInstance { /** * Creates a new instance of the specified class name * * Package private so this code is not exposed at the API level. */ static Object newInstance (ClassLoader classLoader, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Class driverClass; if (classLoader == null) { driverClass = Class.forName(className); } else { driverClass = classLoader.loadClass(className); } return driverClass.newInstance(); } /** * Figure out which ClassLoader to use. For JDK 1.2 and later use * the context ClassLoader. */ static ClassLoader getClassLoader () { Method m = null; try { m = Thread.class.getMethod("getContextClassLoader", null); } catch (NoSuchMethodException e) { // Assume that we are running JDK 1.1, use the current ClassLoader return NewInstance.class.getClassLoader(); } try { return (ClassLoader) m.invoke(Thread.currentThread(), null); } catch (IllegalAccessException e) { // assert(false) throw new UnknownError(e.getMessage()); } catch (InvocationTargetException e) { // assert(e.getTargetException() instanceof SecurityException) throw new UnknownError(e.getMessage()); } } } PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/package.html0000644000175000017500000000050407755336265025500 0ustar wbaerwbaer00000000000000

    This package contains "helper" classes, including support for bootstrapping SAX-based applications.

    See http://www.saxproject.org for more information about SAX.

    PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/ParserAdapter.java0000644000175000017500000006643507755336257026637 0ustar wbaerwbaer00000000000000// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: ParserAdapter.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.io.IOException; import java.util.Enumeration; import java.util.Vector; import org.xml.sax.Parser; // deprecated import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.AttributeList; // deprecated import org.xml.sax.EntityResolver; import org.xml.sax.DTDHandler; import org.xml.sax.DocumentHandler; // deprecated import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; /** * Adapt a SAX1 Parser as a SAX2 XMLReader. * *
    * 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. *
    * *

    This class wraps a SAX1 {@link org.xml.sax.Parser Parser} * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader}, * with feature, property, and Namespace support. Note * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity * skippedEntity} events, since SAX1 does not make that information available.

    * *

    This adapter does not test for duplicate Namespace-qualified * attribute names.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.helpers.XMLReaderAdapter * @see org.xml.sax.XMLReader * @see org.xml.sax.Parser */ public class ParserAdapter implements XMLReader, DocumentHandler { //////////////////////////////////////////////////////////////////// // Constructors. //////////////////////////////////////////////////////////////////// /** * Construct a new parser adapter. * *

    Use the "org.xml.sax.parser" property to locate the * embedded SAX1 driver.

    * * @exception SAXException If the embedded driver * cannot be instantiated or if the * org.xml.sax.parser property is not specified. */ public ParserAdapter () throws SAXException { super(); String driver = System.getProperty("org.xml.sax.parser"); try { setup(ParserFactory.makeParser()); } catch (ClassNotFoundException e1) { throw new SAXException("Cannot find SAX1 driver class " + driver, e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX1 driver class " + driver + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX1 driver class " + driver + " loaded but cannot be instantiated", e3); } catch (ClassCastException e4) { throw new SAXException("SAX1 driver class " + driver + " does not implement org.xml.sax.Parser"); } catch (NullPointerException e5) { throw new SAXException("System property org.xml.sax.parser not specified"); } } /** * Construct a new parser adapter. * *

    Note that the embedded parser cannot be changed once the * adapter is created; to embed a different parser, allocate * a new ParserAdapter.

    * * @param parser The SAX1 parser to embed. * @exception java.lang.NullPointerException If the parser parameter * is null. */ public ParserAdapter (Parser parser) { super(); setup(parser); } /** * Internal setup method. * * @param parser The embedded parser. * @exception java.lang.NullPointerException If the parser parameter * is null. */ private void setup (Parser parser) { if (parser == null) { throw new NullPointerException("Parser argument must not be null"); } this.parser = parser; atts = new AttributesImpl(); nsSupport = new NamespaceSupport(); attAdapter = new AttributeListAdapter(); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.XMLReader. //////////////////////////////////////////////////////////////////// // // Internal constants for the sake of convenience. // private final static String FEATURES = "http://xml.org/sax/features/"; private final static String NAMESPACES = FEATURES + "namespaces"; private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes"; /** * Set a feature flag for the parser. * *

    The only features recognized are namespaces and * namespace-prefixes.

    * * @param name The feature name, as a complete URI. * @param value The requested feature value. * @exception SAXNotRecognizedException If the feature * can't be assigned or retrieved. * @exception SAXNotSupportedException If the feature * can't be assigned that value. * @see org.xml.sax.XMLReader#setFeature */ public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(NAMESPACES)) { checkNotParsing("feature", name); namespaces = value; if (!namespaces && !prefixes) { prefixes = true; } } else if (name.equals(NAMESPACE_PREFIXES)) { checkNotParsing("feature", name); prefixes = value; if (!prefixes && !namespaces) { namespaces = true; } } else { throw new SAXNotRecognizedException("Feature: " + name); } } /** * Check a parser feature flag. * *

    The only features recognized are namespaces and * namespace-prefixes.

    * * @param name The feature name, as a complete URI. * @return The current feature value. * @exception SAXNotRecognizedException If the feature * value can't be assigned or retrieved. * @exception SAXNotSupportedException If the * feature is not currently readable. * @see org.xml.sax.XMLReader#setFeature */ public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(NAMESPACES)) { return namespaces; } else if (name.equals(NAMESPACE_PREFIXES)) { return prefixes; } else { throw new SAXNotRecognizedException("Feature: " + name); } } /** * Set a parser property. * *

    No properties are currently recognized.

    * * @param name The property name. * @param value The property value. * @exception SAXNotRecognizedException If the property * value can't be assigned or retrieved. * @exception SAXNotSupportedException If the property * can't be assigned that value. * @see org.xml.sax.XMLReader#setProperty */ public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotRecognizedException("Property: " + name); } /** * Get a parser property. * *

    No properties are currently recognized.

    * * @param name The property name. * @return The property value. * @exception SAXNotRecognizedException If the property * value can't be assigned or retrieved. * @exception SAXNotSupportedException If the property * value is not currently readable. * @see org.xml.sax.XMLReader#getProperty */ public Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotRecognizedException("Property: " + name); } /** * Set the entity resolver. * * @param resolver The new entity resolver. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setEntityResolver (EntityResolver resolver) { entityResolver = resolver; } /** * Return the current entity resolver. * * @return The current entity resolver, or null if none was supplied. * @see org.xml.sax.XMLReader#getEntityResolver */ public EntityResolver getEntityResolver () { return entityResolver; } /** * Set the DTD handler. * * @param resolver The new DTD handler. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setDTDHandler (DTDHandler handler) { dtdHandler = handler; } /** * Return the current DTD handler. * * @return The current DTD handler, or null if none was supplied. * @see org.xml.sax.XMLReader#getEntityResolver */ public DTDHandler getDTDHandler () { return dtdHandler; } /** * Set the content handler. * * @param resolver The new content handler. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setContentHandler (ContentHandler handler) { contentHandler = handler; } /** * Return the current content handler. * * @return The current content handler, or null if none was supplied. * @see org.xml.sax.XMLReader#getEntityResolver */ public ContentHandler getContentHandler () { return contentHandler; } /** * Set the error handler. * * @param resolver The new error handler. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setErrorHandler (ErrorHandler handler) { errorHandler = handler; } /** * Return the current error handler. * * @return The current error handler, or null if none was supplied. * @see org.xml.sax.XMLReader#getEntityResolver */ public ErrorHandler getErrorHandler () { return errorHandler; } /** * Parse an XML document. * * @param systemId The absolute URL of the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. * @exception SAXException If there is a problem * processing the document. * @see #parse(org.xml.sax.InputSource) * @see org.xml.sax.Parser#parse(java.lang.String) */ public void parse (String systemId) throws IOException, SAXException { parse(new InputSource(systemId)); } /** * Parse an XML document. * * @param input An input source for the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. * @exception SAXException If there is a problem * processing the document. * @see #parse(java.lang.String) * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource) */ public void parse (InputSource input) throws IOException, SAXException { if (parsing) { throw new SAXException("Parser is already in use"); } setupParser(); parsing = true; try { parser.parse(input); } finally { parsing = false; } parsing = false; } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.DocumentHandler. //////////////////////////////////////////////////////////////////// /** * Adapter implementation method; do not call. * Adapt a SAX1 document locator event. * * @param locator A document locator. * @see org.xml.sax.ContentHandler#setDocumentLocator */ public void setDocumentLocator (Locator locator) { this.locator = locator; if (contentHandler != null) { contentHandler.setDocumentLocator(locator); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 start document event. * * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#startDocument */ public void startDocument () throws SAXException { if (contentHandler != null) { contentHandler.startDocument(); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 end document event. * * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#endDocument */ public void endDocument () throws SAXException { if (contentHandler != null) { contentHandler.endDocument(); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 startElement event. * *

    If necessary, perform Namespace processing.

    * * @param qName The qualified (prefixed) name. * @param qAtts The XML 1.0 attribute list (with qnames). * @exception SAXException The client may raise a * processing exception. */ public void startElement (String qName, AttributeList qAtts) throws SAXException { // These are exceptions from the // first pass; they should be // ignored if there's a second pass, // but reported otherwise. Vector exceptions = null; // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { attAdapter.setAttributeList(qAtts); contentHandler.startElement("", "", qName.intern(), attAdapter); } return; } // OK, we're doing Namespace processing. nsSupport.pushContext(); int length = qAtts.getLength(); // First pass: handle NS decls for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); if (!attQName.startsWith("xmlns")) continue; // Could be a declaration... String prefix; int n = attQName.indexOf(':'); // xmlns=... if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... at most, warn continue; } else // xmlns:foo=... prefix = attQName.substring(n+1); String value = qAtts.getValue(i); if (!nsSupport.declarePrefix(prefix, value)) { reportError("Illegal Namespace prefix: " + prefix); continue; } if (contentHandler != null) contentHandler.startPrefixMapping(prefix, value); } // Second pass: copy all relevant // attributes into the SAX2 AttributeList // using updated prefix bindings atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); // Declaration? if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... ignore prefix = null; } else { prefix = attQName.substring(n+1); } // Yes, decl: report or prune if (prefix != null) { if (prefixes) atts.addAttribute("", "", attQName.intern(), type, value); continue; } } // Not a declaration -- report try { String attName[] = processName(attQName, true, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); } catch (SAXException e) { if (exceptions == null) exceptions = new Vector(); exceptions.addElement(e); atts.addAttribute("", attQName, attQName, type, value); } } // now handle the deferred exception reports if (exceptions != null && errorHandler != null) { for (int i = 0; i < exceptions.size(); i++) errorHandler.error((SAXParseException) (exceptions.elementAt(i))); } // OK, finally report the event. if (contentHandler != null) { String name[] = processName(qName, false, false); contentHandler.startElement(name[0], name[1], name[2], atts); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 end element event. * * @param qName The qualified (prefixed) name. * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#endElement */ public void endElement (String qName) throws SAXException { // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { contentHandler.endElement("", "", qName.intern()); } return; } // Split the name. String names[] = processName(qName, false, false); if (contentHandler != null) { contentHandler.endElement(names[0], names[1], names[2]); Enumeration prefixes = nsSupport.getDeclaredPrefixes(); while (prefixes.hasMoreElements()) { String prefix = (String)prefixes.nextElement(); contentHandler.endPrefixMapping(prefix); } } nsSupport.popContext(); } /** * Adapter implementation method; do not call. * Adapt a SAX1 characters event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use. * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#characters */ public void characters (char ch[], int start, int length) throws SAXException { if (contentHandler != null) { contentHandler.characters(ch, start, length); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 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. * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#ignorableWhitespace */ public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { if (contentHandler != null) { contentHandler.ignorableWhitespace(ch, start, length); } } /** * Adapter implementation method; do not call. * Adapt a SAX1 processing instruction event. * * @param target The processing instruction target. * @param data The remainder of the processing instruction * @exception SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#processingInstruction */ public void processingInstruction (String target, String data) throws SAXException { if (contentHandler != null) { contentHandler.processingInstruction(target, data); } } //////////////////////////////////////////////////////////////////// // Internal utility methods. //////////////////////////////////////////////////////////////////// /** * Initialize the parser before each run. */ private void setupParser () { nsSupport.reset(); if (entityResolver != null) { parser.setEntityResolver(entityResolver); } if (dtdHandler != null) { parser.setDTDHandler(dtdHandler); } if (errorHandler != null) { parser.setErrorHandler(errorHandler); } parser.setDocumentHandler(this); locator = null; } /** * Process a qualified (prefixed) name. * *

    If the name has an undeclared prefix, use only the qname * and make an ErrorHandler.error callback in case the app is * interested.

    * * @param qName The qualified (prefixed) name. * @param isAttribute true if this is an attribute name. * @return The name split into three parts. * @exception SAXException The client may throw * an exception if there is an error callback. */ private String [] processName (String qName, boolean isAttribute, boolean useException) throws SAXException { String parts[] = nsSupport.processName(qName, nameParts, isAttribute); if (parts == null) { if (useException) throw makeException("Undeclared prefix: " + qName); reportError("Undeclared prefix: " + qName); parts = new String[3]; parts[0] = parts[1] = ""; parts[2] = qName.intern(); } return parts; } /** * Report a non-fatal error. * * @param message The error message. * @exception SAXException The client may throw * an exception. */ void reportError (String message) throws SAXException { if (errorHandler != null) errorHandler.error(makeException(message)); } /** * Construct an exception for the current context. * * @param message The error message. */ private SAXParseException makeException (String message) { if (locator != null) { return new SAXParseException(message, locator); } else { return new SAXParseException(message, null, null, -1, -1); } } /** * Throw an exception if we are parsing. * *

    Use this method to detect illegal feature or * property changes.

    * * @param type The type of thing (feature or property). * @param name The feature or property name. * @exception SAXNotSupportedException If a * document is currently being parsed. */ private void checkNotParsing (String type, String name) throws SAXNotSupportedException { if (parsing) { throw new SAXNotSupportedException("Cannot change " + type + ' ' + name + " while parsing"); } } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private NamespaceSupport nsSupport; private AttributeListAdapter attAdapter; private boolean parsing = false; private String nameParts[] = new String[3]; private Parser parser = null; private AttributesImpl atts = null; // Features private boolean namespaces = true; private boolean prefixes = false; // Properties // Handlers Locator locator; EntityResolver entityResolver = null; DTDHandler dtdHandler = null; ContentHandler contentHandler = null; ErrorHandler errorHandler = null; //////////////////////////////////////////////////////////////////// // Inner class to wrap an AttributeList when not doing NS proc. //////////////////////////////////////////////////////////////////// /** * Adapt a SAX1 AttributeList as a SAX2 Attributes object. * *

    This class is in the Public Domain, and comes with NO * WARRANTY of any kind.

    * *

    This wrapper class is used only when Namespace support * is disabled -- it provides pretty much a direct mapping * from SAX1 to SAX2, except that names and types are * interned whenever requested.

    */ final class AttributeListAdapter implements Attributes { /** * Construct a new adapter. */ AttributeListAdapter () { } /** * Set the embedded AttributeList. * *

    This method must be invoked before any of the others * can be used.

    * * @param The SAX1 attribute list (with qnames). */ void setAttributeList (AttributeList qAtts) { this.qAtts = qAtts; } /** * Return the length of the attribute list. * * @return The number of attributes in the list. * @see org.xml.sax.Attributes#getLength */ public int getLength () { return qAtts.getLength(); } /** * Return the Namespace URI of the specified attribute. * * @param The attribute's index. * @return Always the empty string. * @see org.xml.sax.Attributes#getURI */ public String getURI (int i) { return ""; } /** * Return the local name of the specified attribute. * * @param The attribute's index. * @return Always the empty string. * @see org.xml.sax.Attributes#getLocalName */ public String getLocalName (int i) { return ""; } /** * Return the qualified (prefixed) name of the specified attribute. * * @param The attribute's index. * @return The attribute's qualified name, internalized. */ public String getQName (int i) { return qAtts.getName(i).intern(); } /** * Return the type of the specified attribute. * * @param The attribute's index. * @return The attribute's type as an internalized string. */ public String getType (int i) { return qAtts.getType(i).intern(); } /** * Return the value of the specified attribute. * * @param The attribute's index. * @return The attribute's value. */ public String getValue (int i) { return qAtts.getValue(i); } /** * Look up an attribute index by Namespace name. * * @param uri The Namespace URI or the empty string. * @param localName The local name. * @return The attributes index, or -1 if none was found. * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) */ public int getIndex (String uri, String localName) { return -1; } /** * Look up an attribute index by qualified (prefixed) name. * * @param qName The qualified name. * @return The attributes index, or -1 if none was found. * @see org.xml.sax.Attributes#getIndex(java.lang.String) */ public int getIndex (String qName) { int max = atts.getLength(); for (int i = 0; i < max; i++) { if (qAtts.getName(i).equals(qName)) { return i; } } return -1; } /** * Look up the type of an attribute by Namespace name. * * @param uri The Namespace URI * @param localName The local name. * @return The attribute's type as an internalized string. */ public String getType (String uri, String localName) { return null; } /** * Look up the type of an attribute by qualified (prefixed) name. * * @param qName The qualified name. * @return The attribute's type as an internalized string. */ public String getType (String qName) { return qAtts.getType(qName).intern(); } /** * Look up the value of an attribute by Namespace name. * * @param uri The Namespace URI * @param localName The local name. * @return The attribute's value. */ public String getValue (String uri, String localName) { return null; } /** * Look up the value of an attribute by qualified (prefixed) name. * * @param qName The qualified name. * @return The attribute's value. */ public String getValue (String qName) { return qAtts.getValue(qName); } private AttributeList qAtts; } } // end of ParserAdapter.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/ParserFactory.java0000644000175000017500000001077407755336260026653 0ustar wbaerwbaer00000000000000// SAX parser factory. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: ParserFactory.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.lang.ClassNotFoundException; import java.lang.IllegalAccessException; import java.lang.InstantiationException; import java.lang.SecurityException; import java.lang.ClassCastException; import org.xml.sax.Parser; /** * Java-specific class for dynamically loading SAX parsers. * *
    * 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. *
    * *

    Note: This class is designed to work with the now-deprecated * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.

    * *

    ParserFactory is not part of the platform-independent definition * of SAX; it is an additional convenience class designed * specifically for Java XML application writers. SAX applications * can use the static methods in this class to allocate a SAX parser * dynamically at run-time based either on the value of the * `org.xml.sax.parser' system property or on a string containing the class * name.

    * *

    Note that the application still requires an XML parser that * implements SAX1.

    * * @deprecated This class works with the deprecated * {@link org.xml.sax.Parser Parser} * interface. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 */ public class ParserFactory { /** * Private null constructor. */ private ParserFactory () { } /** * Create a new SAX parser using the `org.xml.sax.parser' system property. * *

    The named class must exist and must implement the * {@link org.xml.sax.Parser Parser} interface.

    * * @exception java.lang.NullPointerException There is no value * for the `org.xml.sax.parser' system property. * @exception java.lang.ClassNotFoundException The SAX parser * class was not found (check your CLASSPATH). * @exception IllegalAccessException The SAX parser class was * found, but you do not have permission to load * it. * @exception InstantiationException The SAX parser class was * found but could not be instantiated. * @exception java.lang.ClassCastException The SAX parser class * was found and instantiated, but does not implement * org.xml.sax.Parser. * @see #makeParser(java.lang.String) * @see org.xml.sax.Parser */ public static Parser makeParser () throws ClassNotFoundException, IllegalAccessException, InstantiationException, NullPointerException, ClassCastException { String className = System.getProperty("org.xml.sax.parser"); if (className == null) { throw new NullPointerException("No value for sax.parser property"); } else { return makeParser(className); } } /** * Create a new SAX parser object using the class name provided. * *

    The named class must exist and must implement the * {@link org.xml.sax.Parser Parser} interface.

    * * @param className A string containing the name of the * SAX parser class. * @exception java.lang.ClassNotFoundException The SAX parser * class was not found (check your CLASSPATH). * @exception IllegalAccessException The SAX parser class was * found, but you do not have permission to load * it. * @exception InstantiationException The SAX parser class was * found but could not be instantiated. * @exception java.lang.ClassCastException The SAX parser class * was found and instantiated, but does not implement * org.xml.sax.Parser. * @see #makeParser() * @see org.xml.sax.Parser */ public static Parser makeParser (String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException, ClassCastException { return (Parser) NewInstance.newInstance ( NewInstance.getClassLoader (), className); } } PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/XMLFilterImpl.java0000644000175000017500000005261707755336260026521 0ustar wbaerwbaer00000000000000// XMLFilterImpl.java - base SAX2 filter implementation. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the Public Domain. // $Id: XMLFilterImpl.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.io.IOException; import org.xml.sax.XMLReader; import org.xml.sax.XMLFilter; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.DTDHandler; import org.xml.sax.ContentHandler; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXNotRecognizedException; /** * Base class for deriving an XML filter. * *
    * 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. *
    * *

    This class is designed to sit between an {@link org.xml.sax.XMLReader * XMLReader} and the client application's event handlers. By default, it * does nothing but pass requests up to the reader and events * on to the handlers unmodified, but subclasses can override * specific methods to modify the event stream or the configuration * requests as they pass through.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLFilter * @see org.xml.sax.XMLReader * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.ContentHandler * @see org.xml.sax.ErrorHandler */ public class XMLFilterImpl implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler { //////////////////////////////////////////////////////////////////// // Constructors. //////////////////////////////////////////////////////////////////// /** * 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 XMLFilterImpl () { super(); } /** * Construct an XML filter with the specified parent. * * @see #setParent * @see #getParent */ public XMLFilterImpl (XMLReader parent) { super(); setParent(parent); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.XMLFilter. //////////////////////////////////////////////////////////////////// /** * 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. * @see #getParent */ public void setParent (XMLReader parent) { this.parent = parent; } /** * Get the parent reader. * * @return The parent XML reader, or null if none is set. * @see #setParent */ public XMLReader getParent () { return parent; } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.XMLReader. //////////////////////////////////////////////////////////////////// /** * Set the value of a feature. * *

    This will always fail if the parent is null.

    * * @param name The feature name. * @param value The requested feature value. * @exception org.xml.sax.SAXNotRecognizedException If the feature * value can't be assigned or retrieved from the parent. * @exception org.xml.sax.SAXNotSupportedException When the * parent recognizes the feature name but * cannot set the requested value. * @see org.xml.sax.XMLReader#setFeature */ public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { parent.setFeature(name, value); } else { throw new SAXNotRecognizedException("Feature: " + name); } } /** * Look up the value of a feature. * *

    This will always fail if the parent is null.

    * * @param name The feature name. * @return The current value of the feature. * @exception org.xml.sax.SAXNotRecognizedException If the feature * value can't be assigned or retrieved from the parent. * @exception org.xml.sax.SAXNotSupportedException When the * parent recognizes the feature name but * cannot determine its value at this time. * @see org.xml.sax.XMLReader#getFeature */ public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { return parent.getFeature(name); } else { throw new SAXNotRecognizedException("Feature: " + name); } } /** * Set the value of a property. * *

    This will always fail if the parent is null.

    * * @param name The property name. * @param value The requested property value. * @exception org.xml.sax.SAXNotRecognizedException If the property * value can't be assigned or retrieved from the parent. * @exception org.xml.sax.SAXNotSupportedException When the * parent recognizes the property name but * cannot set the requested value. * @see org.xml.sax.XMLReader#setProperty */ public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { parent.setProperty(name, value); } else { throw new SAXNotRecognizedException("Property: " + name); } } /** * Look up the value of a property. * * @param name The property name. * @return The current value of the property. * @exception org.xml.sax.SAXNotRecognizedException If the property * value can't be assigned or retrieved from the parent. * @exception org.xml.sax.SAXNotSupportedException When the * parent recognizes the property name but * cannot determine its value at this time. * @see org.xml.sax.XMLReader#setFeature */ public Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { return parent.getProperty(name); } else { throw new SAXNotRecognizedException("Property: " + name); } } /** * Set the entity resolver. * * @param resolver The new entity resolver. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setEntityResolver (EntityResolver resolver) { entityResolver = resolver; } /** * Get the current entity resolver. * * @return The current entity resolver, or null if none was set. * @see org.xml.sax.XMLReader#getEntityResolver */ public EntityResolver getEntityResolver () { return entityResolver; } /** * Set the DTD event handler. * * @param resolver The new DTD handler. * @see org.xml.sax.XMLReader#setDTDHandler */ public void setDTDHandler (DTDHandler handler) { dtdHandler = handler; } /** * Get the current DTD event handler. * * @return The current DTD handler, or null if none was set. * @see org.xml.sax.XMLReader#getDTDHandler */ public DTDHandler getDTDHandler () { return dtdHandler; } /** * Set the content event handler. * * @param resolver The new content handler. * @see org.xml.sax.XMLReader#setContentHandler */ public void setContentHandler (ContentHandler handler) { contentHandler = 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 contentHandler; } /** * Set the error event handler. * * @param handle The new error handler. * @see org.xml.sax.XMLReader#setErrorHandler */ public void setErrorHandler (ErrorHandler handler) { errorHandler = handler; } /** * Get the current error event handler. * * @return The current error handler, or null if none was set. * @see org.xml.sax.XMLReader#getErrorHandler */ public ErrorHandler getErrorHandler () { return errorHandler; } /** * Parse a document. * * @param input The input source for the document entity. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception 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 SAXException, IOException { setupParse(); parent.parse(input); } /** * Parse a document. * * @param systemId The system identifier as a fully-qualified URI. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception 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 SAXException, IOException { parse(new InputSource(systemId)); } //////////////////////////////////////////////////////////////////// // 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. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @exception 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 (entityResolver != null) { return 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. * @exception org.xml.sax.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 (dtdHandler != null) { 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. * @exception org.xml.sax.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 (dtdHandler != null) { 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) { this.locator = locator; if (contentHandler != null) { contentHandler.setDocumentLocator(locator); } } /** * Filter a start document event. * * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument () throws SAXException { if (contentHandler != null) { contentHandler.startDocument(); } } /** * Filter an end document event. * * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument () throws SAXException { if (contentHandler != null) { contentHandler.endDocument(); } } /** * Filter a start Namespace prefix mapping event. * * @param prefix The Namespace prefix. * @param uri The Namespace URI. * @exception org.xml.sax.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 (contentHandler != null) { contentHandler.startPrefixMapping(prefix, uri); } } /** * Filter an end Namespace prefix mapping event. * * @param prefix The Namespace prefix. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping (String prefix) throws SAXException { if (contentHandler != null) { 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. * @exception org.xml.sax.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 (contentHandler != null) { 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. * @exception org.xml.sax.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 (contentHandler != null) { 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. * @exception org.xml.sax.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 (contentHandler != null) { 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. * @exception org.xml.sax.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 (contentHandler != null) { contentHandler.ignorableWhitespace(ch, start, length); } } /** * Filter a processing instruction event. * * @param target The processing instruction target. * @param data The text following the target. * @exception org.xml.sax.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 (contentHandler != null) { contentHandler.processingInstruction(target, data); } } /** * Filter a skipped entity event. * * @param name The name of the skipped entity. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ContentHandler#skippedEntity */ public void skippedEntity (String name) throws SAXException { if (contentHandler != null) { contentHandler.skippedEntity(name); } } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ErrorHandler. //////////////////////////////////////////////////////////////////// /** * Filter a warning event. * * @param e The nwarning as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#warning */ public void warning (SAXParseException e) throws SAXException { if (errorHandler != null) { errorHandler.warning(e); } } /** * Filter an error event. * * @param e The error as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#error */ public void error (SAXParseException e) throws SAXException { if (errorHandler != null) { errorHandler.error(e); } } /** * Filter a fatal error event. * * @param e The error as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see org.xml.sax.ErrorHandler#fatalError */ public void fatalError (SAXParseException e) throws SAXException { if (errorHandler != null) { errorHandler.fatalError(e); } } //////////////////////////////////////////////////////////////////// // Internal methods. //////////////////////////////////////////////////////////////////// /** * 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 () { if (parent == null) { throw new NullPointerException("No parent for filter"); } parent.setEntityResolver(this); parent.setDTDHandler(this); parent.setContentHandler(this); parent.setErrorHandler(this); } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private XMLReader parent = null; private Locator locator = null; private EntityResolver entityResolver = null; private DTDHandler dtdHandler = null; private ContentHandler contentHandler = null; private ErrorHandler errorHandler = null; } // end of XMLFilterImpl.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/XMLReaderAdapter.java0000644000175000017500000003435007755336257027155 0ustar wbaerwbaer00000000000000// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: XMLReaderAdapter.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.io.IOException; import java.util.Locale; import org.xml.sax.Parser; // deprecated import org.xml.sax.Locator; import org.xml.sax.InputSource; import org.xml.sax.AttributeList; // deprecated import org.xml.sax.EntityResolver; import org.xml.sax.DTDHandler; import org.xml.sax.DocumentHandler; // deprecated import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXNotSupportedException; /** * Adapt a SAX2 XMLReader as a SAX1 Parser. * *
    * 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. *
    * *

    This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader} * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader * must support a true value for the * http://xml.org/sax/features/namespace-prefixes property or parsing will fail * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader * supports a false value for the http://xml.org/sax/features/namespaces * property, that will also be used to improve efficiency.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.Parser * @see org.xml.sax.XMLReader */ public class XMLReaderAdapter implements Parser, ContentHandler { //////////////////////////////////////////////////////////////////// // Constructor. //////////////////////////////////////////////////////////////////// /** * Create a new adapter. * *

    Use the "org.xml.sax.driver" property to locate the SAX2 * driver to embed.

    * * @exception org.xml.sax.SAXException If the embedded driver * cannot be instantiated or if the * org.xml.sax.driver property is not specified. */ public XMLReaderAdapter () throws SAXException { setup(XMLReaderFactory.createXMLReader()); } /** * Create a new adapter. * *

    Create a new adapter, wrapped around a SAX2 XMLReader. * The adapter will make the XMLReader act like a SAX1 * Parser.

    * * @param xmlReader The SAX2 XMLReader to wrap. * @exception java.lang.NullPointerException If the argument is null. */ public XMLReaderAdapter (XMLReader xmlReader) { setup(xmlReader); } /** * Internal setup. * * @param xmlReader The embedded XMLReader. */ private void setup (XMLReader xmlReader) { if (xmlReader == null) { throw new NullPointerException("XMLReader must not be null"); } this.xmlReader = xmlReader; qAtts = new AttributesAdapter(); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.Parser. //////////////////////////////////////////////////////////////////// /** * Set the locale for error reporting. * *

    This is not supported in SAX2, and will always throw * an exception.

    * * @param The locale for error reporting. * @see org.xml.sax.Parser#setLocale * @exception org.xml.sax.SAXException Thrown unless overridden. */ public void setLocale (Locale locale) throws SAXException { throw new SAXNotSupportedException("setLocale not supported"); } /** * Register the entity resolver. * * @param resolver The new resolver. * @see org.xml.sax.Parser#setEntityResolver */ public void setEntityResolver (EntityResolver resolver) { xmlReader.setEntityResolver(resolver); } /** * Register the DTD event handler. * * @param handler The new DTD event handler. * @see org.xml.sax.Parser#setDTDHandler */ public void setDTDHandler (DTDHandler handler) { xmlReader.setDTDHandler(handler); } /** * Register the SAX1 document event handler. * *

    Note that the SAX1 document handler has no Namespace * support.

    * * @param handler The new SAX1 document event handler. * @see org.xml.sax.Parser#setDocumentHandler */ public void setDocumentHandler (DocumentHandler handler) { documentHandler = handler; } /** * Register the error event handler. * * @param handler The new error event handler. * @see org.xml.sax.Parser#setErrorHandler */ public void setErrorHandler (ErrorHandler handler) { xmlReader.setErrorHandler(handler); } /** * Parse the document. * *

    This method will throw an exception if the embedded * XMLReader does not support the * http://xml.org/sax/features/namespace-prefixes property.

    * * @param systemId The absolute URL of the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. * @exception org.xml.sax.SAXException If there is a problem * processing the document. * @see #parse(org.xml.sax.InputSource) * @see org.xml.sax.Parser#parse(java.lang.String) */ public void parse (String systemId) throws IOException, SAXException { parse(new InputSource(systemId)); } /** * Parse the document. * *

    This method will throw an exception if the embedded * XMLReader does not support the * http://xml.org/sax/features/namespace-prefixes property.

    * * @param input An input source for the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. * @exception org.xml.sax.SAXException If there is a problem * processing the document. * @see #parse(java.lang.String) * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource) */ public void parse (InputSource input) throws IOException, SAXException { setupXMLReader(); xmlReader.parse(input); } /** * Set up the XML reader. */ private void setupXMLReader () throws SAXException { xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); try { xmlReader.setFeature("http://xml.org/sax/features/namespaces", false); } catch (SAXException e) { // NO OP: it's just extra information, and we can ignore it } xmlReader.setContentHandler(this); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.ContentHandler. //////////////////////////////////////////////////////////////////// /** * Set a document locator. * * @param locator The document locator. * @see org.xml.sax.ContentHandler#setDocumentLocator */ public void setDocumentLocator (Locator locator) { if (documentHandler != null) documentHandler.setDocumentLocator(locator); } /** * Start document event. * * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument () throws SAXException { if (documentHandler != null) documentHandler.startDocument(); } /** * End document event. * * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument () throws SAXException { if (documentHandler != null) documentHandler.endDocument(); } /** * Adapt a SAX2 start prefix mapping event. * * @param prefix The prefix being mapped. * @param uri The Namespace URI being mapped to. * @see org.xml.sax.ContentHandler#startPrefixMapping */ public void startPrefixMapping (String prefix, String uri) { } /** * Adapt a SAX2 end prefix mapping event. * * @param prefix The prefix being mapped. * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping (String prefix) { } /** * Adapt a SAX2 start element event. * * @param uri The Namespace URI. * @param localName The Namespace local name. * @param qName The qualified (prefixed) name. * @param atts The SAX2 attributes. * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#endDocument */ public void startElement (String uri, String localName, String qName, Attributes atts) throws SAXException { if (documentHandler != null) { qAtts.setAttributes(atts); documentHandler.startElement(qName, qAtts); } } /** * Adapt a SAX2 end element event. * * @param uri The Namespace URI. * @param localName The Namespace local name. * @param qName The qualified (prefixed) name. * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#endElement */ public void endElement (String uri, String localName, String qName) throws SAXException { if (documentHandler != null) documentHandler.endElement(qName); } /** * Adapt a SAX2 characters event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use. * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#characters */ public void characters (char ch[], int start, int length) throws SAXException { if (documentHandler != null) documentHandler.characters(ch, start, length); } /** * Adapt a SAX2 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. * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#ignorableWhitespace */ public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { if (documentHandler != null) documentHandler.ignorableWhitespace(ch, start, length); } /** * Adapt a SAX2 processing instruction event. * * @param target The processing instruction target. * @param data The remainder of the processing instruction * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction (String target, String data) throws SAXException { if (documentHandler != null) documentHandler.processingInstruction(target, data); } /** * Adapt a SAX2 skipped entity event. * * @param name The name of the skipped entity. * @see org.xml.sax.ContentHandler#skippedEntity * @exception org.xml.sax.SAXException Throwable by subclasses. */ public void skippedEntity (String name) throws SAXException { } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// XMLReader xmlReader; DocumentHandler documentHandler; AttributesAdapter qAtts; //////////////////////////////////////////////////////////////////// // Internal class. //////////////////////////////////////////////////////////////////// /** * Internal class to wrap a SAX2 Attributes object for SAX1. */ final class AttributesAdapter implements AttributeList { AttributesAdapter () { } /** * Set the embedded Attributes object. * * @param The embedded SAX2 Attributes. */ void setAttributes (Attributes attributes) { this.attributes = attributes; } /** * Return the number of attributes. * * @return The length of the attribute list. * @see org.xml.sax.AttributeList#getLength */ public int getLength () { return attributes.getLength(); } /** * Return the qualified (prefixed) name of an attribute by position. * * @return The qualified name. * @see org.xml.sax.AttributeList#getName */ public String getName (int i) { return attributes.getQName(i); } /** * Return the type of an attribute by position. * * @return The type. * @see org.xml.sax.AttributeList#getType(int) */ public String getType (int i) { return attributes.getType(i); } /** * Return the value of an attribute by position. * * @return The value. * @see org.xml.sax.AttributeList#getValue(int) */ public String getValue (int i) { return attributes.getValue(i); } /** * Return the type of an attribute by qualified (prefixed) name. * * @return The type. * @see org.xml.sax.AttributeList#getType(java.lang.String) */ public String getType (String qName) { return attributes.getType(qName); } /** * Return the value of an attribute by qualified (prefixed) name. * * @return The value. * @see org.xml.sax.AttributeList#getValue(java.lang.String) */ public String getValue (String qName) { return attributes.getValue(qName); } private Attributes attributes; } } // end of XMLReaderAdapter.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/helpers/XMLReaderFactory.java0000644000175000017500000001565407755336260027204 0ustar wbaerwbaer00000000000000// XMLReaderFactory.java - factory for creating a new reader. // http://www.saxproject.org // Written by David Megginson // and by David Brownell // NO WARRANTY! This class is in the Public Domain. // $Id: XMLReaderFactory.java,v 1.1 2001/12/10 22:38:05 aslom Exp $ package org.xml.sax.helpers; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.xml.sax.XMLReader; import org.xml.sax.SAXException; /** * Factory for creating an XML reader. * *
    * 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. *
    * *

    This class contains static methods for creating an XML reader * from an explicit class name, or based on runtime defaults:

    * *
     * try {
     *   XMLReader myReader = XMLReaderFactory.createXMLReader();
     * } catch (SAXException e) {
     *   System.err.println(e.getMessage());
     * }
     * 
    * *

    Note to Distributions bundled with parsers: * You should modify the implementation of the no-arguments * createXMLReader to handle cases where the external * configuration mechanisms aren't set up. That method should do its * best to return a parser when one is in the class path, even when * nothing bound its class name to org.xml.sax.driver so * those configuration mechanisms would see it.

    * * @since SAX 2.0 * @author David Megginson, David Brownell * @version 2.0r2pre3 */ final public class XMLReaderFactory { /** * Private constructor. * *

    This constructor prevents the class from being instantiated.

    */ private XMLReaderFactory () { } private static final String property = "org.xml.sax.driver"; /** * Attempt to create an XMLReader from system defaults. * In environments which can support it, the name of the XMLReader * class is determined by trying each these options in order, and * using the first one which succeeds:

      * *
    • If the system property org.xml.sax.driver * has a value, that is used as an XMLReader class name.
    • * *
    • The JAR "Services API" is used to look for a class name * in the META-INF/services/org.xml.sax.driver file in * jarfiles available to the runtime.
    • * *
    • SAX parser distributions are strongly encouraged to provide * a default XMLReader class name that will take effect only when * previous options (on this list) are not successful.
    • * *
    • Finally, if {@link ParserFactory#makeParser()} can * return a system default SAX1 parser, that parser is wrapped in * a {@link ParserAdapter}. (This is a migration aid for SAX1 * environments, where the org.xml.sax.parser system * property will often be usable.)
    • * *
    * *

    In environments such as small embedded systems, which can not * support that flexibility, other mechanisms to determine the default * may be used.

    * *

    Note that many Java environments allow system properties to be * initialized on a command line. This means that in most cases * setting a good value for that property ensures that calls to this * method will succeed, except when security policies intervene. * This will also maximize application portability to older SAX * environments, with less robust implementations of this method. *

    * * @return A new XMLReader. * @exception org.xml.sax.SAXException If no default XMLReader class * can be identified and instantiated. * @see #createXMLReader(java.lang.String) */ public static XMLReader createXMLReader () throws SAXException { String className = null; ClassLoader loader = NewInstance.getClassLoader (); // 1. try the JVM-instance-wide system property try { className = System.getProperty (property); } catch (Exception e) { /* normally fails for applets */ } // 2. if that fails, try META-INF/services/ if (className == null) { try { String service = "META-INF/services/" + property; InputStream in; BufferedReader reader; if (loader == null) in = ClassLoader.getSystemResourceAsStream (service); else in = loader.getResourceAsStream (service); if (in != null) { reader = new BufferedReader ( new InputStreamReader (in, "UTF8")); className = reader.readLine (); in.close (); } } catch (Exception e) { } } // 3. Distro-specific fallback if (className == null) { // BEGIN DISTRIBUTION-SPECIFIC // EXAMPLE: // className = "com.example.sax.XmlReader"; // or a $JAVA_HOME/jre/lib/*properties setting... // END DISTRIBUTION-SPECIFIC } // do we know the XMLReader implementation class yet? if (className != null) return loadClass (loader, className); // 4. panic -- adapt any SAX1 parser try { return new ParserAdapter (ParserFactory.makeParser ()); } catch (Exception e) { throw new SAXException ("Can't create default XMLReader; " + "is system property org.xml.sax.driver set?"); } } /** * Attempt to create an XML reader from a class name. * *

    Given a class name, this method attempts to load * and instantiate the class as an XML reader.

    * *

    Note that this method will not be usable in environments where * the caller (perhaps an applet) is not permitted to load classes * dynamically.

    * * @return A new XML reader. * @exception org.xml.sax.SAXException If the class cannot be * loaded, instantiated, and cast to XMLReader. * @see #createXMLReader() */ public static XMLReader createXMLReader (String className) throws SAXException { return loadClass (NewInstance.getClassLoader (), className); } private static XMLReader loadClass (ClassLoader loader, String className) throws SAXException { try { return (XMLReader) NewInstance.newInstance (loader, className); } catch (ClassNotFoundException e1) { throw new SAXException("SAX2 driver class " + className + " not found", e1); } catch (IllegalAccessException e2) { throw new SAXException("SAX2 driver class " + className + " found but cannot be loaded", e2); } catch (InstantiationException e3) { throw new SAXException("SAX2 driver class " + className + " loaded but cannot be instantiated (no empty public constructor?)", e3); } catch (ClassCastException e4) { throw new SAXException("SAX2 driver class " + className + " does not implement XMLReader", e4); } } } PullParser2.1.10/src/java/apis/sax2/org/xml/sax/AttributeList.java0000644000175000017500000001535307755336260025222 0ustar wbaerwbaer00000000000000// SAX Attribute List Interface. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: AttributeList.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Interface for an element's attribute specifications. * *
    * 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. *
    * *

    This is the original SAX1 interface for reporting an element's * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes} * interface, it does not support Namespace-related information.

    * *

    When an attribute list is supplied as part of a * {@link org.xml.sax.DocumentHandler#startElement startElement} * event, the list will return valid results only during the * scope of the event; once the event handler returns control * to the parser, the attribute list is invalid. To save a * persistent copy of the attribute list, use the SAX1 * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl} * helper class.

    * *

    An attribute list includes only attributes that have been * specified or defaulted: #IMPLIED attributes will not be included.

    * *

    There are two ways for the SAX application to obtain information * from the AttributeList. First, it can iterate through the entire * list:

    * *
     * public void startElement (String name, AttributeList atts) {
     *   for (int i = 0; i < atts.getLength(); i++) {
     *     String name = atts.getName(i);
     *     String type = atts.getType(i);
     *     String value = atts.getValue(i);
     *     [...]
     *   }
     * }
     * 
    * *

    (Note that the result of getLength() will be zero if there * are no attributes.) * *

    As an alternative, the application can request the value or * type of specific attributes:

    * *
     * public void startElement (String name, AttributeList atts) {
     *   String identifier = atts.getValue("id");
     *   String label = atts.getValue("label");
     *   [...]
     * }
     * 
    * * @deprecated This interface has been replaced by the SAX2 * {@link org.xml.sax.Attributes Attributes} * interface, which includes Namespace support. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.DocumentHandler#startElement startElement * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl */ public interface AttributeList { //////////////////////////////////////////////////////////////////// // Iteration methods. //////////////////////////////////////////////////////////////////// /** * Return the number of attributes in this list. * *

    The SAX parser may provide attributes in any * arbitrary order, regardless of the order in which they were * declared or specified. The number of attributes may be * zero.

    * * @return The number of attributes in the list. */ public abstract int getLength (); /** * Return the name of an attribute in this list (by position). * *

    The names must be unique: the SAX parser shall not include the * same attribute twice. Attributes without values (those declared * #IMPLIED without a value specified in the start tag) will be * omitted from the list.

    * *

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

    * * @param i The index of the attribute in the list (starting at 0). * @return The name of the indexed attribute, or null * if the index is out of range. * @see #getLength */ public abstract String getName (int i); /** * Return the type of an attribute in the list (by position). * *

    The attribute type is one of the strings "CDATA", "ID", * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", * or "NOTATION" (always in upper case).

    * *

    If the parser has not read a declaration for the attribute, * or if the parser does not report attribute types, then it must * return the value "CDATA" as stated in the XML 1.0 Recommentation * (clause 3.3.3, "Attribute-Value Normalization").

    * *

    For an enumerated attribute that is not a notation, the * parser will report the type as "NMTOKEN".

    * * @param i The index of the attribute in the list (starting at 0). * @return The attribute type as a string, or * null if the index is out of range. * @see #getLength * @see #getType(java.lang.String) */ public abstract String getType (int i); /** * Return the value of an attribute in the list (by position). * *

    If the attribute value is a list of tokens (IDREFS, * ENTITIES, or NMTOKENS), the tokens will be concatenated * into a single string separated by whitespace.

    * * @param i The index of the attribute in the list (starting at 0). * @return The attribute value as a string, or * null if the index is out of range. * @see #getLength * @see #getValue(java.lang.String) */ public abstract String getValue (int i); //////////////////////////////////////////////////////////////////// // Lookup methods. //////////////////////////////////////////////////////////////////// /** * Return the type of an attribute in the list (by name). * *

    The return value is the same as the return value for * getType(int).

    * *

    If the attribute name has a namespace prefix in the document, * the application must include the prefix here.

    * * @param name The name of the attribute. * @return The attribute type as a string, or null if no * such attribute exists. * @see #getType(int) */ public abstract String getType (String name); /** * Return the value of an attribute in the list (by name). * *

    The return value is the same as the return value for * getValue(int).

    * *

    If the attribute name has a namespace prefix in the document, * the application must include the prefix here.

    * * @param i The index of the attribute in the list. * @return The attribute value as a string, or null if * no such attribute exists. * @see #getValue(int) */ public abstract String getValue (String name); } // end of AttributeList.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/Attributes.java0000644000175000017500000002011007755336257024542 0ustar wbaerwbaer00000000000000// Attributes.java - attribute list with Namespace support // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: Attributes.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Interface for a list of XML attributes. * *
    * 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. *
    * *

    This interface allows access to a list of attributes in * three different ways:

    * *
      *
    1. by attribute index;
    2. *
    3. by Namespace-qualified name; or
    4. *
    5. by qualified (prefixed) name.
    6. *
    * *

    The list will not contain attributes that were declared * #IMPLIED but not specified in the start tag. It will also not * contain attributes used as Namespace declarations (xmlns*) unless * the http://xml.org/sax/features/namespace-prefixes * feature is set to true (it is false by * default).

    * *

    If the namespace-prefixes feature (see above) is false, * access by qualified name may not be available; if the * http://xml.org/sax/features/namespaces * feature is false, access by Namespace-qualified names * may not be available.

    * *

    This interface replaces the now-deprecated SAX1 {@link * org.xml.sax.AttributeList AttributeList} interface, which does not * contain Namespace support. In addition to Namespace support, it * adds the getIndex methods (below).

    * *

    The order of attributes in the list is unspecified, and will * vary from implementation to implementation.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.helpers.AttributesImpl * @see org.xml.sax.ext.DeclHandler#attributeDecl */ public interface Attributes { //////////////////////////////////////////////////////////////////// // Indexed access. //////////////////////////////////////////////////////////////////// /** * Return the number of attributes in the list. * *

    Once you know the number of attributes, you can iterate * through the list.

    * * @return The number of attributes in the list. * @see #getURI(int) * @see #getLocalName(int) * @see #getQName(int) * @see #getType(int) * @see #getValue(int) */ public abstract int 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. * @see #getLength */ public abstract String getURI (int index); /** * 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. * @see #getLength */ public abstract String getLocalName (int index); /** * Look up an attribute's XML 1.0 qualified name by index. * * @param index The attribute index (zero-based). * @return The XML 1.0 qualified name, or the empty string * if none is available, or null if the index * is out of range. * @see #getLength */ public abstract String getQName (int index); /** * Look up an attribute's type by index. * *

    The attribute type is one of the strings "CDATA", "ID", * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", * or "NOTATION" (always in upper case).

    * *

    If the parser has not read a declaration for the attribute, * or if the parser does not report attribute types, then it must * return the value "CDATA" as stated in the XML 1.0 Recommentation * (clause 3.3.3, "Attribute-Value Normalization").

    * *

    For an enumerated attribute that is not a notation, the * parser will report the type as "NMTOKEN".

    * * @param index The attribute index (zero-based). * @return The attribute's type as a string, or null if the * index is out of range. * @see #getLength */ public abstract String getType (int index); /** * Look up an attribute's value by index. * *

    If the attribute value is a list of tokens (IDREFS, * ENTITIES, or NMTOKENS), the tokens will be concatenated * into a single string with each token separated by a * single space.

    * * @param index The attribute index (zero-based). * @return The attribute's value as a string, or null if the * index is out of range. * @see #getLength */ public abstract String getValue (int index); //////////////////////////////////////////////////////////////////// // Name-based query. //////////////////////////////////////////////////////////////////// /** * 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 localName 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 localName); /** * Look up the index of an attribute by XML 1.0 qualified 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); /** * Look up an attribute's type by Namespace name. * *

    See {@link #getType(int) getType(int)} for a description * of the possible types.

    * * @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 abstract String getType (String uri, String localName); /** * Look up an attribute's type by XML 1.0 qualified name. * *

    See {@link #getType(int) getType(int)} for a description * of the possible types.

    * * @param qName The XML 1.0 qualified name. * @return The attribute type as a string, or null if the * attribute is not in the list or if qualified names * are not available. */ public abstract String getType (String qName); /** * Look up an attribute's value by Namespace name. * *

    See {@link #getValue(int) getValue(int)} for a description * of the possible values.

    * * @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 abstract String getValue (String uri, String localName); /** * Look up an attribute's value by XML 1.0 qualified name. * *

    See {@link #getValue(int) getValue(int)} for a description * of the possible values.

    * * @param qName The XML 1.0 qualified name. * @return The attribute value as a string, or null if the * attribute is not in the list or if qualified names * are not available. */ public abstract String getValue (String qName); } // end of Attributes.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ContentHandler.java0000644000175000017500000003662207755336257025343 0ustar wbaerwbaer00000000000000// ContentHandler.java - handle main document content. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the public domain. // $Id: ContentHandler.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Receive notification of the logical content of a document. * *
    * 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. *
    * *

    This is the main interface that most SAX applications * implement: if the application needs to be informed of basic parsing * events, it implements this interface and registers an instance with * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler * setContentHandler} method. The parser uses the instance to report * basic document-related events like the start and end of elements * and character data.

    * *

    The order of events in this interface is very important, and * mirrors the order of information in the document itself. For * example, all of an element's content (character data, processing * instructions, and/or subelements) will appear, in order, between * the startElement event and the corresponding endElement event.

    * *

    This interface is similar to the now-deprecated SAX 1.0 * DocumentHandler interface, but it adds support for Namespaces * and for reporting skipped entities (in non-validating XML * processors).

    * *

    Implementors should note that there is also a Java class * {@link java.net.ContentHandler ContentHandler} in the java.net * package; that means that it's probably a bad idea to do

    * *
    * import java.net.*; * import org.xml.sax.*; *
    * *

    In fact, "import ...*" is usually a sign of sloppy programming * anyway, so the user should consider this a feature rather than a * bug.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLReader * @see org.xml.sax.DTDHandler * @see org.xml.sax.ErrorHandler */ public interface ContentHandler { /** * 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); /** * 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 {@link org.xml.sax.DTDHandler * DTDHandler} (except for {@link #setDocumentLocator * setDocumentLocator}).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #endDocument */ public void startDocument () 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.

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #startDocument */ public void endDocument() throws SAXException; /** * 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 immediately before the * corresponding {@link #startElement startElement} event, * and all {@link #endPrefixMapping endPrefixMapping} * events will occur immediately after the corresponding * {@link #endElement endElement} event, * but their order is not otherwise * guaranteed.

    * *

    There should never be start/endPrefixMapping events for the * "xml" prefix, since it is predeclared and immutable.

    * * @param prefix The Namespace prefix being declared. * @param uri The Namespace URI the prefix is mapped to. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see #endPrefixMapping * @see #startElement */ public void startPrefixMapping (String prefix, String uri) throws SAXException; /** * End the scope of a prefix-URI mapping. * *

    See {@link #startPrefixMapping startPrefixMapping} for * details. These events will always occur immediately after the * corresponding {@link #endElement endElement} event, but the order of * {@link #endPrefixMapping endPrefixMapping} events is not otherwise * guaranteed.

    * * @param prefix The prefix that was being mapping. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see #startPrefixMapping * @see #endElement */ public void endPrefixMapping (String prefix) throws SAXException; /** * 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 * {@link #endElement 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.

    * *

    This event allows up to three name components for each * element:

    * *
      *
    1. the Namespace URI;
    2. *
    3. the local name; and
    4. *
    5. the qualified (prefixed) name.
    6. *
    * *

    Any or all of these may be provided, depending on the * values of the http://xml.org/sax/features/namespaces * and the http://xml.org/sax/features/namespace-prefixes * properties:

    * *
      *
    • the Namespace URI and local name are required when * the namespaces property is true (the default), and are * optional when the namespaces property is false (if one is * specified, both must be);
    • *
    • the qualified name is required when the namespace-prefixes property * is true, and is optional when the namespace-prefixes property * is false (the default).
    • *
    * *

    Note that the attribute list provided will contain only * attributes with explicit values (specified or defaulted): * #IMPLIED attributes will be omitted. The attribute list * will contain attributes used for Namespace declarations * (xmlns* attributes) only if the * http://xml.org/sax/features/namespace-prefixes * property is true (it is false by default, and support for a * true value is optional).

    * * @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 atts The attributes attached to the element. If * there are no attributes, it shall be an empty * Attributes object. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #endElement * @see org.xml.sax.Attributes */ public void startElement (String namespaceURI, String localName, String qName, Attributes atts) 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 * {@link #startElement startElement} event for every endElement * event (even when the element is empty).

    * *

    For information on the names, see startElement.

    * * @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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void endElement (String namespaceURI, String localName, String qName) throws SAXException; /** * 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 in element * content using the {@link #ignorableWhitespace 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. * @exception 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 SAXException; /** * Receive notification of ignorable whitespace in element content. * *

    Validating Parsers must use this method to report each chunk * of whitespace in element content (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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #characters */ 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 must 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. The data does not include any * whitespace separating it from the target. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void processingInstruction (String target, String data) throws 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 '%', and if * it is the external DTD subset, it will be the string * "[dtd]". * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public void skippedEntity (String name) throws SAXException; } // end of ContentHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/DocumentHandler.java0000644000175000017500000002262007755336260025472 0ustar wbaerwbaer00000000000000// SAX document handler. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: DocumentHandler.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Receive notification of general document events. * *
    * 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. *
    * *

    This was the main event-handling interface for SAX1; in * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler * ContentHandler}, which provides Namespace support and reporting * of skipped entities. This interface is included in SAX2 only * to support legacy SAX1 applications.

    * *

    The order of events in this interface is very important, and * mirrors the order of information in the document itself. For * example, all of an element's content (character data, processing * instructions, and/or subelements) will appear, in order, between * the startElement event and the corresponding endElement event.

    * *

    Application writers who do not want to implement the entire * interface can derive a class from HandlerBase, which implements * the default functionality; parser writers can instantiate * HandlerBase to obtain a default handler. The application can find * the location of any document event using the Locator interface * supplied by the Parser through the setDocumentLocator method.

    * * @deprecated This interface has been replaced by the SAX2 * {@link org.xml.sax.ContentHandler ContentHandler} * interface, which includes Namespace support. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.Parser#setDocumentHandler * @see org.xml.sax.Locator * @see org.xml.sax.HandlerBase */ public interface DocumentHandler { /** * 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.

    * * @param locator An object that can return the location of * any SAX document event. * @see org.xml.sax.Locator */ public abstract void setDocumentLocator (Locator locator); /** * 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).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public abstract void startDocument () 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.

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public abstract void endDocument () throws SAXException; /** * 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 name The element type name. * @param atts The attributes attached to the element, if any. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #endElement * @see org.xml.sax.AttributeList */ public abstract void startElement (String name, AttributeList atts) 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 name The element type name * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public abstract void endElement (String name) throws SAXException; /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #ignorableWhitespace * @see org.xml.sax.Locator */ public abstract void characters (char ch[], int start, int length) throws SAXException; /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #characters */ public abstract 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ public abstract void processingInstruction (String target, String data) throws SAXException; } // end of DocumentHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/DTDHandler.java0000644000175000017500000001077007755336257024340 0ustar wbaerwbaer00000000000000// SAX DTD handler. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: DTDHandler.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Receive notification of basic DTD-related events. * *
    * 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. *
    * *

    If a SAX application needs information about notations and * unparsed entities, then the application implements this * interface and registers an instance with the SAX parser using * the parser's setDTDHandler method. The parser uses the * instance to report notation and unparsed entity declarations to * the application.

    * *

    Note that this interface includes only those DTD events that * the XML recommendation requires processors to report: * notation and unparsed entity declarations.

    * *

    The SAX parser may report these events in any order, regardless * of the order in which the notations and unparsed entities were * declared; however, all DTD events must be reported after the * document handler's startDocument event, and before the first * startElement event. * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is * used, these events must also be reported before the endDTD event.) *

    * *

    It is up to the application to store the information for * future use (perhaps in a hash table or object tree). * If the application encounters attributes of type "NOTATION", * "ENTITY", or "ENTITIES", it can use the information that it * obtained through this interface to find the entity and/or * notation corresponding with the attribute value.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLReader#setDTDHandler */ public interface DTDHandler { /** * Receive notification of a notation declaration event. * *

    It is up to the application to record the notation for later * reference, if necessary; * notations may appear as attribute values and in unparsed entity * declarations, and are sometime used with processing instruction * target names.

    * *

    At least one of publicId and systemId must be non-null. * If a system identifier is present, and it is a URL, the SAX * parser must resolve it fully before passing it to the * application through this event.

    * *

    There is no guarantee that the notation declaration will be * reported before any unparsed entities that use it.

    * * @param name The notation name. * @param publicId The notation's public identifier, or null if * none was given. * @param systemId The notation's system identifier, or null if * none was given. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #unparsedEntityDecl * @see org.xml.sax.Attributes */ public abstract void notationDecl (String name, String publicId, String systemId) throws SAXException; /** * Receive notification of an unparsed entity declaration event. * *

    Note that the notation name corresponds to a notation * reported by the {@link #notationDecl notationDecl} event. * It is up to the application to record the entity for later * reference, if necessary; * unparsed entities may appear as attribute values. *

    * *

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

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @param name The unparsed entity's name. * @param publicId The entity's public identifier, or null if none * was given. * @param systemId The entity's system identifier. * @param notationName The name of the associated notation. * @see #notationDecl * @see org.xml.sax.Attributes */ public abstract void unparsedEntityDecl (String name, String publicId, String systemId, String notationName) throws SAXException; } // end of DTDHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/EntityResolver.java0000644000175000017500000001146707755336260025423 0ustar wbaerwbaer00000000000000// SAX entity resolver. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: EntityResolver.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; import java.io.IOException; /** * Basic interface for resolving entities. * *
    * 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. *
    * *

    If a SAX application needs to implement customized handling * for external entities, it must implement this interface and * register an instance with the SAX driver using the * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver} * method.

    * *

    The XML reader will then allow the application to intercept any * external entities (including the external DTD subset and external * parameter entities, if any) before including them.

    * *

    Many SAX applications will not need to implement this interface, * but it will be especially useful for applications that build * XML documents from databases or other specialised input sources, * or for applications that use URI types other than URLs.

    * *

    The following resolver would provide the application * with a special character stream for the entity with the system * identifier "http://www.myhost.com/today":

    * *
     * import org.xml.sax.EntityResolver;
     * import org.xml.sax.InputSource;
     *
     * public class MyResolver implements EntityResolver {
     *   public InputSource resolveEntity (String publicId, String systemId)
     *   {
     *     if (systemId.equals("http://www.myhost.com/today")) {
     *              // return a special input source
     *       MyReader reader = new MyReader();
     *       return new InputSource(reader);
     *     } else {
     *              // use the default behaviour
     *       return null;
     *     }
     *   }
     * }
     * 
    * *

    The application can also use this interface to redirect system * identifiers to local URIs or to look up replacements in a catalog * (possibly by using the public identifier).

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLReader#setEntityResolver * @see org.xml.sax.InputSource */ public interface EntityResolver { /** * Allow the application to resolve external entities. * *

    The parser will call this method before opening any external * entity except the top-level document entity. Such entities include * the external DTD subset and external parameter entities referenced * within the DTD (in either case, only if the parser reads external * parameter entities), and external general entities referenced * within the document element (if the parser reads external general * entities). The application may request that the parser locate * the entity itself, that it use an alternative URI, or that it * use data provided by the application (as a character or byte * input stream).

    * *

    Application writers can use this method to redirect external * system identifiers to secure and/or local URIs, to look up * public identifiers in a catalogue, or to read an entity from a * database or other input source (including, for example, a dialog * box). Neither XML nor SAX specifies a preferred policy for using * public or system IDs to resolve resources. However, SAX specifies * how to interpret any InputSource returned by this method, and that * if none is returned, then the system ID will be dereferenced as * a URL.

    * *

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

    * * @param publicId The public identifier of the external entity * being referenced, or null if none was supplied. * @param systemId The system identifier of the external entity * being referenced. * @return An InputSource object describing the new input source, * or null to request that the parser open a regular * URI connection to the system identifier. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception java.io.IOException A Java-specific IO exception, * possibly the result of creating a new InputStream * or Reader for the InputSource. * @see org.xml.sax.InputSource */ public abstract InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException; } // end of EntityResolver.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/ErrorHandler.java0000644000175000017500000001170707755336260025011 0ustar wbaerwbaer00000000000000// SAX error handler. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: ErrorHandler.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Basic interface for SAX error handlers. * *
    * 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. *
    * *

    If a SAX application needs to implement customized error * handling, it must implement this interface and then register an * instance with the XML reader using the * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler} * method. The parser will then report all errors and warnings * through this interface.

    * *

    WARNING: If an application does not * register an ErrorHandler, XML parsing errors will go unreported * and bizarre behaviour may result.

    * *

    For XML processing errors, a SAX driver must use this interface * instead of throwing an exception: it is up to the application * to decide whether to throw an exception for different types of * errors and warnings. Note, however, that there is no requirement that * the parser continue to provide useful information after a call to * {@link #fatalError fatalError} (in other words, a SAX driver class * could catch an exception and report a fatalError).

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLReader#setErrorHandler * @see org.xml.sax.SAXParseException */ public interface 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. * @see org.xml.sax.SAXParseException */ public abstract void warning (SAXParseException exception) throws SAXException; /** * 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. * @see org.xml.sax.SAXParseException */ public abstract void error (SAXParseException exception) throws SAXException; /** * 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. * @see org.xml.sax.SAXParseException */ public abstract void fatalError (SAXParseException exception) throws SAXException; } // end of ErrorHandler.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/HandlerBase.java0000644000175000017500000003154407755336257024601 0ustar wbaerwbaer00000000000000// SAX default handler base class. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: HandlerBase.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Default base class for handlers. * *
    * 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. *
    * *

    This class implements the default behaviour for four SAX1 * interfaces: EntityResolver, DTDHandler, DocumentHandler, * and ErrorHandler. It is now obsolete, but is included in SAX2 to * support legacy SAX1 applications. SAX2 applications should use * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler} * class instead.

    * *

    Application writers can extend this class when they need to * implement only part of an interface; parser writers can * instantiate this class to provide default handlers when the * application has not supplied its own.

    * *

    Note that the use of this class is optional.

    * * @deprecated This class works with the deprecated * {@link org.xml.sax.DocumentHandler DocumentHandler} * interface. It has been replaced by the SAX2 * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler} * class. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.DocumentHandler * @see org.xml.sax.ErrorHandler */ public class HandlerBase implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler { //////////////////////////////////////////////////////////////////// // Default 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity (String publicId, String systemId) throws SAXException { return null; } //////////////////////////////////////////////////////////////////// // 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. * @see org.xml.sax.DTDHandler#notationDecl */ public void notationDecl (String name, String publicId, String systemId) { // 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. * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl (String name, String publicId, String systemId, String notationName) { // no op } //////////////////////////////////////////////////////////////////// // Default implementation of DocumentHandler 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.DocumentHandler#setDocumentLocator * @see org.xml.sax.Locator */ public void setDocumentLocator (Locator locator) { // no op } /** * 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).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#startDocument */ public void startDocument () throws SAXException { // no op } /** * 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 beginning * of a document (such as finalising a tree or closing an output * file).

    * * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#endDocument */ public void endDocument () throws SAXException { // no op } /** * 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 name The element type name. * @param attributes The specified or defaulted attributes. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#startElement */ public void startElement (String name, AttributeList attributes) throws SAXException { // no op } /** * 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 name The element type name. * @param attributes The specified or defaulted attributes. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#endElement */ public void endElement (String name) throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#characters */ public void characters (char ch[], int start, int length) throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#ignorableWhitespace */ public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { // no op } /** * 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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.DocumentHandler#processingInstruction */ public void processingInstruction (String target, String data) throws SAXException { // no op } //////////////////////////////////////////////////////////////////// // Default 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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 { // no op } /** * 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. * @exception org.xml.sax.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; } } // end of HandlerBase.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/InputSource.java0000644000175000017500000002443407755336260024703 0ustar wbaerwbaer00000000000000// SAX input source. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: InputSource.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; import java.io.Reader; import java.io.InputStream; /** * A single input source for an XML entity. * *
    * 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. *
    * *

    This class allows a SAX application to encapsulate information * about an input source in a single object, which may include * a public identifier, a system identifier, a byte stream (possibly * with a specified encoding), and/or a character stream.

    * *

    There are two places that the application can deliver an * input source to the parser: as the argument to the Parser.parse * method, or as the return value of the EntityResolver.resolveEntity * method.

    * *

    The SAX parser will use the InputSource object to determine how * to read XML input. If there is a character stream available, the * parser will read that stream directly, ignoring any text encoding * declaration found in that stream as well as any encoding specified * in the InputSource. If there is no character stream, but there is * a byte stream, the parser will use that byte stream, using the * encoding specified in the InputSource or else (if no encoding is * specified) autodetecting the character encoding using an algorithm * such as the one in the XML specification. If neither a character * stream nor a * byte stream is available, the parser will attempt to open a URI * connection to the resource identified by the system * identifier.

    * *

    An InputSource object belongs to the application: the SAX parser * shall never modify it in any way (it may modify a copy if * necessary). However, standard processing of both byte and * character streams is to close them on as part of end-of-parse cleanup, * so applications should not attempt to re-use such streams after they * have been handed to a parser.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) * @see org.xml.sax.EntityResolver#resolveEntity * @see java.io.InputStream * @see java.io.Reader */ public class InputSource { /** * Zero-argument default constructor. * * @see #setPublicId * @see #setSystemId * @see #setByteStream * @see #setCharacterStream * @see #setEncoding */ public InputSource () { } /** * Create a new input source with a system identifier. * *

    Applications may use setPublicId to include a * public identifier as well, or setEncoding to specify * the character encoding, if known.

    * *

    If the system identifier is a URL, it must be fully * resolved (it may not be a relative URL).

    * * @param systemId The system identifier (URI). * @see #setPublicId * @see #setSystemId * @see #setByteStream * @see #setEncoding * @see #setCharacterStream */ public InputSource (String systemId) { setSystemId(systemId); } /** * Create a new input source with a byte stream. * *

    Application writers should use setSystemId() to provide a base * for resolving relative URIs, may use setPublicId to include a * public identifier, and may use setEncoding to specify the object's * character encoding.

    * * @param byteStream The raw byte stream containing the document. * @see #setPublicId * @see #setSystemId * @see #setEncoding * @see #setByteStream * @see #setCharacterStream */ public InputSource (InputStream byteStream) { setByteStream(byteStream); } /** * Create a new input source with a character stream. * *

    Application writers should use setSystemId() to provide a base * for resolving relative URIs, and may use setPublicId to include a * public identifier.

    * *

    The character stream shall not include a byte order mark.

    * * @see #setPublicId * @see #setSystemId * @see #setByteStream * @see #setCharacterStream */ public InputSource (Reader characterStream) { setCharacterStream(characterStream); } /** * Set the public identifier for this input source. * *

    The public identifier is always optional: if the application * writer includes one, it will be provided as part of the * location information.

    * * @param publicId The public identifier as a string. * @see #getPublicId * @see org.xml.sax.Locator#getPublicId * @see org.xml.sax.SAXParseException#getPublicId */ public void setPublicId (String publicId) { this.publicId = publicId; } /** * Get the public identifier for this input source. * * @return The public identifier, or null if none was supplied. * @see #setPublicId */ public String getPublicId () { return publicId; } /** * Set the system identifier for this input source. * *

    The system identifier is optional if there is a byte stream * or a character stream, but it is still useful to provide one, * since the application can use it to resolve relative URIs * and can include it in error messages and warnings (the parser * will attempt to open a connection to the URI only if * there is no byte stream or character stream specified).

    * *

    If the application knows the character encoding of the * object pointed to by the system identifier, it can register * the encoding using the setEncoding method.

    * *

    If the system identifier is a URL, it must be fully * resolved (it may not be a relative URL).

    * * @param systemId The system identifier as a string. * @see #setEncoding * @see #getSystemId * @see org.xml.sax.Locator#getSystemId * @see org.xml.sax.SAXParseException#getSystemId */ public void setSystemId (String systemId) { this.systemId = systemId; } /** * Get the system identifier for this input source. * *

    The getEncoding method will return the character encoding * of the object pointed to, or null if unknown.

    * *

    If the system ID is a URL, it will be fully resolved.

    * * @return The system identifier, or null if none was supplied. * @see #setSystemId * @see #getEncoding */ public String getSystemId () { return systemId; } /** * Set the byte stream for this input source. * *

    The SAX parser will ignore this if there is also a character * stream specified, but it will use a byte stream in preference * to opening a URI connection itself.

    * *

    If the application knows the character encoding of the * byte stream, it should set it with the setEncoding method.

    * * @param byteStream A byte stream containing an XML document or * other entity. * @see #setEncoding * @see #getByteStream * @see #getEncoding * @see java.io.InputStream */ public void setByteStream (InputStream byteStream) { this.byteStream = byteStream; } /** * Get the byte stream for this input source. * *

    The getEncoding method will return the character * encoding for this byte stream, or null if unknown.

    * * @return The byte stream, or null if none was supplied. * @see #getEncoding * @see #setByteStream */ public InputStream getByteStream () { return byteStream; } /** * Set the character encoding, if known. * *

    The encoding must be a string acceptable for an * XML encoding declaration (see section 4.3.3 of the XML 1.0 * recommendation).

    * *

    This method has no effect when the application provides a * character stream.

    * * @param encoding A string describing the character encoding. * @see #setSystemId * @see #setByteStream * @see #getEncoding */ public void setEncoding (String encoding) { this.encoding = encoding; } /** * Get the character encoding for a byte stream or URI. * This value will be ignored when the application provides a * character stream. * * @return The encoding, or null if none was supplied. * @see #setByteStream * @see #getSystemId * @see #getByteStream */ public String getEncoding () { return encoding; } /** * Set the character stream for this input source. * *

    If there is a character stream specified, the SAX parser * will ignore any byte stream and will not attempt to open * a URI connection to the system identifier.

    * * @param characterStream The character stream containing the * XML document or other entity. * @see #getCharacterStream * @see java.io.Reader */ public void setCharacterStream (Reader characterStream) { this.characterStream = characterStream; } /** * Get the character stream for this input source. * * @return The character stream, or null if none was supplied. * @see #setCharacterStream */ public Reader getCharacterStream () { return characterStream; } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private String publicId; private String systemId; private InputStream byteStream; private String encoding; private Reader characterStream; } // end of InputSource.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/Locator.java0000644000175000017500000001136007755336257024026 0ustar wbaerwbaer00000000000000// SAX locator interface for document events. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: Locator.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Interface for associating a SAX event with a document location. * *
    * 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. *
    * *

    If a SAX parser provides location information to the SAX * application, it does so by implementing this interface and then * passing an instance to the application using the content * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator * setDocumentLocator} method. The application can use the * object to obtain the location of any other SAX event * in the XML source document.

    * *

    Note that the results returned by the object will be valid only * during the scope of each callback method: the application * will receive unpredictable results if it attempts to use the * locator at any other time, or after parsing completes.

    * *

    SAX parsers are not required to supply a locator, but they are * very strongly encouraged to do so. If the parser supplies a * locator, it must do so before reporting any other document events. * If no locator has been set by the time the application receives * the {@link org.xml.sax.ContentHandler#startDocument startDocument} * event, the application should assume that a locator is not * available.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.ContentHandler#setDocumentLocator */ public interface Locator { /** * 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 abstract String 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 abstract String 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.

    * *

    If possible, the SAX driver should provide the line position * of the first character after the text associated with the document * event. The first line in the document is line 1.

    * * @return The line number, or -1 if none is available. * @see #getColumnNumber */ public abstract int 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.

    * *

    If possible, the SAX driver should provide the line position * of the first character after the text associated with the document * event. The first column in each line is column 1.

    * * @return The column number, or -1 if none is available. * @see #getLineNumber */ public abstract int getColumnNumber (); } // end of Locator.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/package.html0000644000175000017500000001136707755336265024047 0ustar wbaerwbaer00000000000000

    This package provides the core SAX APIs. Some SAX1 APIs are deprecated to encourage integration of namespace-awareness into designs of new applications and into maintainance of existing infrastructure.

    See http://www.saxproject.org for more information about SAX.

    SAX2 Standard Feature Flags

    One of the essential characteristics of SAX2 is that it added feature flags which can be used to examine and perhaps modify parser modes, in particular modes such as validation. Since features are identified by (absolute) URIs, anyone can define such features. Currently defined standard feature URIs have the prefix http://xml.org/sax/features/ before an identifier such as validation. Turn features on or off using setFeature. Those standard identifiers are:

    Feature ID Default Description
    external-general-entities unspecified Reports whether this parser processes external general entities; always true if validating
    external-parameter-entities unspecified Reports whether this parser processes external parameter entities; always true if validating
    lexical-handler/parameter-entities unspecified true indicates that the LexicalHandler will report the beginning and end of parameter entities
    namespaces true true indicates namespace URIs and unprefixed local names for element and attribute names will be available
    namespace-prefixes false true indicates XML 1.0 names (with prefixes) and attributes (including xmlns* attributes) will be available
    string-interning unspecified true if all XML names (for elements, prefixes, attributes, entities, notations, and local names), as well as Namespace URIs, will have been interned using java.lang.String.intern. This supports fast testing of equality/inequality against string constants.
    validation unspecified controls whether the parser is reporting all validity errors; if true, all external entities will be read.

    Support for the default values of the namespaces and namespace-prefixes properties is required.

    For default values not specified by SAX2, each XMLReader implementation specifies its default, or may choose not to expose the feature flag. Implementations may support changing current values of these standard feature flags, but not while parsing.

    SAX2 Standard Handler and Property IDs

    For parser interface characteristics that are described as objects, a separate namespace is defined. The objects in this namespace are again identified by URI, and the standard property URIs have the prefix http://xml.org/sax/properties/ before an identifier such as lexical-handler or dom-node. Manage those properties using setProperty(). Those identifiers are:

    Property ID Description
    declaration-handler Used to see most DTD declarations except those treated as lexical ("document element name is ...") or which are mandatory for all SAX parsers (DTDHandler). The Object must implement DeclHandler.
    dom-node For "DOM Walker" style parsers, which ignore their parser.parse() parameters, this is used to specify the DOM (sub)tree being walked by the parser.
    lexical-handler Used to see some syntax events that are essential in some applications: comments, CDATA delimeters, selected general entity inclusions, and the start and end of the DTD (and declaration of document element name). The Object must implement LexicalHandler.
    xml-string Readable only during a parser callback, this exposes a TBS chunk of characters responsible for the current event.

    All of these standard properties are optional; XMLReader implementations need not support them.

    PullParser2.1.10/src/java/apis/sax2/org/xml/sax/Parser.java0000644000175000017500000001730207755336257023661 0ustar wbaerwbaer00000000000000// SAX parser interface. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: Parser.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; import java.io.IOException; import java.util.Locale; /** * Basic interface for SAX (Simple API for XML) parsers. * *
    * 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. *
    * *

    This was the main event supplier interface for SAX1; it has * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader}, * which includes Namespace support and sophisticated configurability * and extensibility.

    * *

    All SAX1 parsers must implement this basic interface: it allows * applications to register handlers for different types of events * and to initiate a parse from a URI, or a character stream.

    * *

    All SAX1 parsers must also implement a zero-argument constructor * (though other constructors are also allowed).

    * *

    SAX1 parsers are reusable but not re-entrant: the application * may reuse a parser object (possibly with a different input source) * once the first parse has completed successfully, but it may not * invoke the parse() methods recursively within a parse.

    * * @deprecated This interface has been replaced by the SAX2 * {@link org.xml.sax.XMLReader XMLReader} * interface, which includes Namespace support. * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.DocumentHandler * @see org.xml.sax.ErrorHandler * @see org.xml.sax.HandlerBase * @see org.xml.sax.InputSource */ public interface Parser { /** * Allow an application to request a locale for errors and warnings. * *

    SAX parsers are not required to provide localisation for errors * and warnings; if they cannot support the requested locale, * however, they must throw a SAX exception. Applications may * not request a locale change in the middle of a parse.

    * * @param locale A Java Locale object. * @exception org.xml.sax.SAXException Throws an exception * (using the previous or default locale) if the * requested locale is not supported. * @see org.xml.sax.SAXException * @see org.xml.sax.SAXParseException */ public abstract void setLocale (Locale locale) throws SAXException; /** * Allow an application to register a custom entity resolver. * *

    If the application does not register an entity resolver, the * SAX parser will resolve system identifiers and open connections * to entities itself (this is the default behaviour implemented in * HandlerBase).

    * *

    Applications may register a new or different entity resolver * in the middle of a parse, and the SAX parser must begin using * the new resolver immediately.

    * * @param resolver The object for resolving entities. * @see EntityResolver * @see HandlerBase */ public abstract void setEntityResolver (EntityResolver resolver); /** * Allow an application to register a DTD event handler. * *

    If the application does not register a DTD handler, all DTD * events reported by the SAX parser will be silently * ignored (this is the default behaviour implemented by * HandlerBase).

    * *

    Applications may register a new or different * handler in the middle of a parse, and the SAX parser must * begin using the new handler immediately.

    * * @param handler The DTD handler. * @see DTDHandler * @see HandlerBase */ public abstract void setDTDHandler (DTDHandler handler); /** * Allow an application to register a document event handler. * *

    If the application does not register a document handler, all * document events reported by the SAX parser will be silently * ignored (this is the default behaviour implemented by * HandlerBase).

    * *

    Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately.

    * * @param handler The document handler. * @see DocumentHandler * @see HandlerBase */ public abstract void setDocumentHandler (DocumentHandler handler); /** * Allow an application to register an error event handler. * *

    If the application does not register an error event handler, * all error events reported by the SAX parser will be silently * ignored, except for fatalError, which will throw a SAXException * (this is the default behaviour implemented by HandlerBase).

    * *

    Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately.

    * * @param handler The error handler. * @see ErrorHandler * @see SAXException * @see HandlerBase */ public abstract void setErrorHandler (ErrorHandler handler); /** * Parse an XML document. * *

    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. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception 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.InputSource * @see #parse(java.lang.String) * @see #setEntityResolver * @see #setDTDHandler * @see #setDocumentHandler * @see #setErrorHandler */ public abstract void parse (InputSource source) throws SAXException, IOException; /** * Parse an XML document from a system identifier (URI). * *

    This method is a shortcut for the common case of reading a * document from a system identifier. It is the exact * equivalent of the following:

    * *
         * parse(new InputSource(systemId));
         * 
    * *

    If the system identifier is a URL, it must be fully resolved * by the application before it is passed to the parser.

    * * @param systemId The system identifier (URI). * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see #parse(org.xml.sax.InputSource) */ public abstract void parse (String systemId) throws SAXException, IOException; } // end of Parser.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/SAXException.java0000644000175000017500000000772607755336257024750 0ustar wbaerwbaer00000000000000// SAX exception class. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: SAXException.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Encapsulate a general SAX error or warning. * *
    * 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. *
    * *

    This class can contain basic error or warning information from * either the XML parser or the application: a parser writer or * application writer can subclass it to provide additional * functionality. SAX handlers may throw this exception or * any exception subclassed from it.

    * *

    If the application needs to pass through other types of * exceptions, it must wrap those exceptions in a SAXException * or an exception derived from a SAXException.

    * *

    If the parser or application needs to include information about a * specific location in an XML document, it should use the * {@link org.xml.sax.SAXParseException SAXParseException} subclass.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.SAXParseException */ public class SAXException extends Exception { /** * Create a new SAXException. */ public SAXException () { super(); this.exception = null; } /** * Create a new SAXException. * * @param message The error or warning message. */ public SAXException (String message) { super(message); this.exception = null; } /** * Create a new SAXException wrapping an existing exception. * *

    The existing exception will be embedded in the new * one, and its message will become the default message for * the SAXException.

    * * @param e The exception to be wrapped in a SAXException. */ public SAXException (Exception e) { super(); this.exception = e; } /** * Create a new SAXException from an existing exception. * *

    The existing exception will be embedded in the new * one, but the new exception will have its own message.

    * * @param message The detail message. * @param e The exception to be wrapped in a SAXException. */ public SAXException (String message, Exception e) { super(message); this.exception = e; } /** * Return a detail message for this exception. * *

    If there is an embedded exception, and if the SAXException * has no detail message of its own, this method will return * the detail message from the embedded exception.

    * * @return The error or warning message. */ public String getMessage () { String message = super.getMessage(); if (message == null && exception != null) { return exception.getMessage(); } else { return message; } } /** * Return the embedded exception, if any. * * @return The embedded exception, or null if there is none. */ public Exception getException () { return exception; } /** * Override toString to pick up any embedded exception. * * @return A string representation of this exception. */ public String toString () { if (exception != null) { return exception.toString(); } else { return super.toString(); } } ////////////////////////////////////////////////////////////////////// // Internal state. ////////////////////////////////////////////////////////////////////// /** * @serial The embedded exception if tunnelling, or null. */ private Exception exception; } // end of SAXException.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/SAXNotRecognizedException.java0000644000175000017500000000261207755336257027430 0ustar wbaerwbaer00000000000000// SAXNotRecognizedException.java - unrecognized feature or value. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the Public Domain. // $Id: SAXNotRecognizedException.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Exception class for an unrecognized identifier. * *
    * 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. *
    * *

    An XMLReader will throw this exception when it finds an * unrecognized feature or property identifier; SAX applications and * extensions may use this class for other, similar purposes.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.SAXNotSupportedException */ public class SAXNotRecognizedException extends SAXException { /** * Default constructor. */ public SAXNotRecognizedException () { super(); } /** * Construct a new exception with the given message. * * @param message The text message of the exception. */ public SAXNotRecognizedException (String message) { super(message); } } // end of SAXNotRecognizedException.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/SAXNotSupportedException.java0000644000175000017500000000273207755336260027321 0ustar wbaerwbaer00000000000000// SAXNotSupportedException.java - unsupported feature or value. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the Public Domain. // $Id: SAXNotSupportedException.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Exception class for an unsupported operation. * *
    * 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. *
    * *

    An XMLReader will throw this exception when it recognizes a * feature or property identifier, but cannot perform the requested * operation (setting a state or value). Other SAX2 applications and * extensions may use this class for similar purposes.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.SAXNotRecognizedException */ public class SAXNotSupportedException extends SAXException { /** * Construct a new exception with no message. */ public SAXNotSupportedException () { super(); } /** * Construct a new exception with the given message. * * @param message The text message of the exception. */ public SAXNotSupportedException (String message) { super(message); } } // end of SAXNotSupportedException.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/SAXParseException.java0000644000175000017500000002067507755336260025733 0ustar wbaerwbaer00000000000000// SAX exception class. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. // $Id: SAXParseException.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Encapsulate an XML parse error or warning. * *
    * 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. *
    * *

    This exception will include information for locating the error * in the original XML document. Note that although the application * will receive a SAXParseException as the argument to the handlers * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface, * the application is not actually required to throw the exception; * instead, it can simply read the information in it and take a * different action.

    * *

    Since this exception is a subclass of {@link org.xml.sax.SAXException * SAXException}, it inherits the ability to wrap another exception.

    * * @since SAX 1.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.SAXException * @see org.xml.sax.Locator * @see org.xml.sax.ErrorHandler */ public class SAXParseException extends SAXException { ////////////////////////////////////////////////////////////////////// // Constructors. ////////////////////////////////////////////////////////////////////// /** * Create a new SAXParseException from a message and a Locator. * *

    This constructor is especially useful when an application is * creating its own exception from within a {@link org.xml.sax.ContentHandler * ContentHandler} callback.

    * * @param message The error or warning message. * @param locator The locator object for the error or warning (may be * null). * @see org.xml.sax.Locator */ public SAXParseException (String message, Locator locator) { super(message); if (locator != null) { init(locator.getPublicId(), locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { init(null, null, -1, -1); } } /** * Wrap an existing exception in a SAXParseException. * *

    This constructor is especially useful when an application is * creating its own exception from within a {@link org.xml.sax.ContentHandler * ContentHandler} callback, and needs to wrap an existing exception that is not a * subclass of {@link org.xml.sax.SAXException SAXException}.

    * * @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 (may be * null). * @param e Any exception. * @see org.xml.sax.Locator */ public SAXParseException (String message, Locator locator, Exception e) { super(message, e); if (locator != null) { init(locator.getPublicId(), locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { init(null, null, -1, -1); } } /** * Create a new SAXParseException. * *

    This constructor is most useful for parser writers.

    * *

    If the system identifier is a URL, the parser must resolve it * fully before creating the exception.

    * * @param message The error or warning message. * @param publicId The public identifer of the entity that generated * the error or warning. * @param systemId The system identifer of the entity that generated * the error or warning. * @param lineNumber The line number of the end of the text that * caused the error or warning. * @param columnNumber The column number of the end of the text that * cause the error or warning. */ public SAXParseException (String message, String publicId, String systemId, int lineNumber, int columnNumber) { super(message); init(publicId, systemId, lineNumber, columnNumber); } /** * Create a new SAXParseException with an embedded exception. * *

    This constructor is most useful for parser writers who * need to wrap an exception that is not a subclass of * {@link org.xml.sax.SAXException SAXException}.

    * *

    If the system identifier is a URL, the parser must resolve it * fully before creating the exception.

    * * @param message The error or warning message, or null to use * the message from the embedded exception. * @param publicId The public identifer of the entity that generated * the error or warning. * @param systemId The system identifer of the entity that generated * the error or warning. * @param lineNumber The line number of the end of the text that * caused the error or warning. * @param columnNumber The column number of the end of the text that * cause the error or warning. * @param e Another exception to embed in this one. */ public SAXParseException (String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e) { super(message, e); init(publicId, systemId, lineNumber, columnNumber); } /** * Internal initialization method. * * @param publicId The public identifier of the entity which generated the exception, * or null. * @param systemId The system identifier of the entity which generated the exception, * or null. * @param lineNumber The line number of the error, or -1. * @param columnNumber The column number of the error, or -1. */ private void init (String publicId, String systemId, int lineNumber, int columnNumber) { this.publicId = publicId; this.systemId = systemId; this.lineNumber = lineNumber; this.columnNumber = columnNumber; } /** * Get the public identifier of the entity where the exception occurred. * * @return A string containing the public identifier, or null * if none is available. * @see org.xml.sax.Locator#getPublicId */ public String getPublicId () { return this.publicId; } /** * Get the system identifier of the entity where the exception occurred. * *

    If the system identifier is a URL, it will be resolved * fully.

    * * @return A string containing the system identifier, or null * if none is available. * @see org.xml.sax.Locator#getSystemId */ public String getSystemId () { return this.systemId; } /** * The line number of the end of the text where the exception occurred. * * @return An integer representing the line number, or -1 * if none is available. * @see org.xml.sax.Locator#getLineNumber */ public int getLineNumber () { return this.lineNumber; } /** * The column number of the end of the text where the exception occurred. * *

    The first column in a line is position 1.

    * * @return An integer representing the column number, or -1 * if none is available. * @see org.xml.sax.Locator#getColumnNumber */ public int getColumnNumber () { return this.columnNumber; } ////////////////////////////////////////////////////////////////////// // Internal state. ////////////////////////////////////////////////////////////////////// /** * @serial The public identifier, or null. * @see #getPublicId */ private String publicId; /** * @serial The system identifier, or null. * @see #getSystemId */ private String systemId; /** * @serial The line number, or -1. * @see #getLineNumber */ private int lineNumber; /** * @serial The column number, or -1. * @see #getColumnNumber */ private int columnNumber; } // end of SAXParseException.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/XMLFilter.java0000644000175000017500000000415207755336257024232 0ustar wbaerwbaer00000000000000// XMLFilter.java - filter SAX2 events. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the Public Domain. // $Id: XMLFilter.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; /** * Interface for an XML filter. * *
    * 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. *
    * *

    An XML filter is like an XML reader, except that it obtains its * events from another XML reader rather than a primary source like * an XML document or database. Filters can modify a stream of * events as they pass on to the final application.

    * *

    The XMLFilterImpl helper class provides a convenient base * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler}, * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler * ErrorHandler} events automatically.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.helpers.XMLFilterImpl */ public interface XMLFilter extends XMLReader { /** * Set the parent reader. * *

    This method allows the application to link the filter to * a parent reader (which may be another filter). The argument * may not be null.

    * * @param parent The parent reader. */ public abstract void setParent (XMLReader parent); /** * Get the parent reader. * *

    This method allows the application to query the parent * reader (which may be another filter). It is generally a * bad idea to perform any operations on the parent reader * directly: they should all pass through this filter.

    * * @return The parent filter, or null if none has been set. */ public abstract XMLReader getParent (); } // end of XMLFilter.java PullParser2.1.10/src/java/apis/sax2/org/xml/sax/XMLReader.java0000644000175000017500000003516207755336260024206 0ustar wbaerwbaer00000000000000// XMLReader.java - read an XML document. // http://www.saxproject.org // Written by David Megginson // NO WARRANTY! This class is in the Public Domain. // $Id: XMLReader.java,v 1.1 2001/12/10 22:38:03 aslom Exp $ package org.xml.sax; import java.io.IOException; /** * Interface for reading an XML document using callbacks. * *
    * 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. *
    * *

    Note: despite its name, this interface does * not extend the standard Java {@link java.io.Reader Reader} * interface, because reading XML is a fundamentally different activity * than reading character data.

    * *

    XMLReader is the interface that an XML parser's SAX2 driver must * implement. This interface allows an application to set and * query features and properties in the parser, to register * event handlers for document processing, and to initiate * a document parse.

    * *

    All SAX interfaces are assumed to be synchronous: the * {@link #parse parse} methods must not return until parsing * is complete, and readers must wait for an event-handler callback * to return before reporting the next event.

    * *

    This interface replaces the (now deprecated) SAX 1.0 {@link * org.xml.sax.Parser Parser} interface. The XMLReader interface * contains two important enhancements over the old Parser * interface (as well as some minor ones):

    * *
      *
    1. it adds a standard way to query and set features and * properties; and
    2. *
    3. it adds Namespace support, which is required for many * higher-level XML standards.
    4. *
    * *

    There are adapters available to convert a SAX1 Parser to * a SAX2 XMLReader and vice-versa.

    * * @since SAX 2.0 * @author David Megginson * @version 2.0r2pre3 * @see org.xml.sax.XMLFilter * @see org.xml.sax.helpers.ParserAdapter * @see org.xml.sax.helpers.XMLReaderAdapter */ public interface XMLReader { //////////////////////////////////////////////////////////////////// // Configuration. //////////////////////////////////////////////////////////////////// /** * Look up the value of a feature flag. * *

    The feature name is any fully-qualified URI. It is * possible for an XMLReader to recognize a feature name but * temporarily be unable to return its value. * Some feature values may be available only in specific * contexts, such as before, during, or after a parse. * Also, some feature values may not be programmatically accessible. * (In the case of an adapter for SAX1 {@link Parser}, there is no * implementation-independent way to expose whether the underlying * parser is performing validation, expanding external entities, * and so forth.)

    * *

    All XMLReaders are required to recognize the * http://xml.org/sax/features/namespaces and the * http://xml.org/sax/features/namespace-prefixes feature names.

    * *

    Typical usage is something like this:

    * *
         * XMLReader r = new MySAXDriver();
         *
         *                         // try to activate validation
         * try {
         *   r.setFeature("http://xml.org/sax/features/validation", true);
         * } catch (SAXException e) {
         *   System.err.println("Cannot activate validation."); 
         * }
         *
         *                         // register event handlers
         * r.setContentHandler(new MyContentHandler());
         * r.setErrorHandler(new MyErrorHandler());
         *
         *                         // parse the first document
         * try {
         *   r.parse("http://www.foo.com/mydoc.xml");
         * } catch (IOException e) {
         *   System.err.println("I/O exception reading XML document");
         * } catch (SAXException e) {
         *   System.err.println("XML exception reading document.");
         * }
         * 
    * *

    Implementors are free (and encouraged) to invent their own features, * using names built on their own URIs.

    * * @param name The feature name, which is a fully-qualified URI. * @return The current value of the feature (true or false). * @exception org.xml.sax.SAXNotRecognizedException If the feature * value can't be assigned or retrieved. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the feature name but * cannot determine its value at this time. * @see #setFeature */ public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException; /** * Set the value of a feature flag. * *

    The feature name is any fully-qualified URI. It is * possible for an XMLReader to expose a feature value but * to be unable to change the current value. * Some feature values may be immutable or mutable only * in specific contexts, such as before, during, or after * a parse.

    * *

    All XMLReaders are required to support setting * http://xml.org/sax/features/namespaces to true and * http://xml.org/sax/features/namespace-prefixes to false.

    * * @param name The feature name, which is a fully-qualified URI. * @param value The requested value of the feature (true or false). * @exception org.xml.sax.SAXNotRecognizedException If the feature * value can't be assigned or retrieved. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the feature name but * cannot set the requested value. * @see #getFeature */ public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException; /** * Look up the value of a property. * *

    The property name is any fully-qualified URI. It is * possible for an XMLReader to recognize a property name but * temporarily be unable to return its value. * Some property values may be available only in specific * contexts, such as before, during, or after a parse.

    * *

    XMLReaders are not required to recognize any specific * property names, though an initial core set is documented for * SAX2.

    * *

    Implementors are free (and encouraged) to invent their own properties, * using names built on their own URIs.

    * * @param name The property name, which is a fully-qualified URI. * @return The current value of the property. * @exception org.xml.sax.SAXNotRecognizedException If the property * value can't be assigned or retrieved. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the property name but * cannot determine its value at this time. * @see #setProperty */ public Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException; /** * Set the value of a property. * *

    The property name is any fully-qualified URI. It is * possible for an XMLReader to recognize a property name but * to be unable to change the current value. * Some property values may be immutable or mutable only * in specific contexts, such as before, during, or after * a parse.

    * *

    XMLReaders are not required to recognize setting * any specific property names, though a core set is defined by * SAX2.

    * *

    This method is also the standard mechanism for setting * extended handlers.

    * * @param name The property name, which is a fully-qualified URI. * @param value The requested value for the property. * @exception org.xml.sax.SAXNotRecognizedException If the property * value can't be assigned or retrieved. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the property name but * cannot set the requested value. */ public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException; //////////////////////////////////////////////////////////////////// // Event handlers. //////////////////////////////////////////////////////////////////// /** * Allow an application to register an entity resolver. * *

    If the application does not register an entity resolver, * the XMLReader will perform its own default resolution.

    * *

    Applications may register a new or different resolver in the * middle of a parse, and the SAX parser must begin using the new * resolver immediately.

    * * @param resolver The entity resolver. * @see #getEntityResolver */ public void setEntityResolver (EntityResolver resolver); /** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver (); /** * Allow an application to register a DTD event handler. * *

    If the application does not register a DTD handler, all DTD * events reported by the SAX parser will be silently ignored.

    * *

    Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately.

    * * @param handler The DTD handler. * @see #getDTDHandler */ public void setDTDHandler (DTDHandler handler); /** * Return the current DTD handler. * * @return The current DTD handler, or null if none * has been registered. * @see #setDTDHandler */ public DTDHandler getDTDHandler (); /** * Allow an application to register a content event handler. * *

    If the application does not register a content handler, all * content events reported by the SAX parser will be silently * ignored.

    * *

    Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately.

    * * @param handler The content handler. * @see #getContentHandler */ public void setContentHandler (ContentHandler handler); /** * Return the current content handler. * * @return The current content handler, or null if none * has been registered. * @see #setContentHandler */ public ContentHandler getContentHandler (); /** * Allow an application to register an error event handler. * *

    If the application does not register an error handler, all * error events reported by the SAX parser will be silently * ignored; however, normal processing may not continue. It is * highly recommended that all SAX applications implement an * error handler to avoid unexpected bugs.

    * *

    Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately.

    * * @param handler The error handler. * @see #getErrorHandler */ public void setErrorHandler (ErrorHandler handler); /** * Return the current error handler. * * @return The current error handler, or null if none * has been registered. * @see #setErrorHandler */ public ErrorHandler getErrorHandler (); //////////////////////////////////////////////////////////////////// // Parsing. //////////////////////////////////////////////////////////////////// /** * Parse an XML document. * *

    The application can use this method to instruct the XML * reader 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 XMLReader instead for each * nested XML document). Once a parse is complete, an * application may reuse the same XMLReader object, possibly with a * different input source.

    * *

    During the parse, the XMLReader will provide information * about the XML document through the registered event * handlers.

    * *

    This method is synchronous: it will not return until parsing * has ended. If a client application wants to terminate * parsing early, it should throw an exception.

    * * @param source The input source for the top-level of the * XML document. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception 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.InputSource * @see #parse(java.lang.String) * @see #setEntityResolver * @see #setDTDHandler * @see #setContentHandler * @see #setErrorHandler */ public void parse (InputSource input) throws IOException, SAXException; /** * Parse an XML document from a system identifier (URI). * *

    This method is a shortcut for the common case of reading a * document from a system identifier. It is the exact * equivalent of the following:

    * *
         * parse(new InputSource(systemId));
         * 
    * *

    If the system identifier is a URL, it must be fully resolved * by the application before it is passed to the parser.

    * * @param systemId The system identifier (URI). * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. * @see #parse(org.xml.sax.InputSource) */ public void parse (String systemId) throws IOException, SAXException; } PullParser2.1.10/src/java/apis/sax2/README.txt0000644000175000017500000000004407755336265021070 0ustar wbaerwbaer00000000000000SAX2 API based on sax2-r2pre3.jar PullParser2.1.10/src/java/drivers/0000755000175000017500000000000007755336254017237 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/0000755000175000017500000000000010232453172020322 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/META-INF/0000755000175000017500000000000007755336260021500 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/META-INF/services/0000755000175000017500000000000010232453172023305 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/META-INF/services/javax.xml.parsers.SAXParserFactory0000644000175000017500000000005107755336260031767 0ustar wbaerwbaer00000000000000org.gjt.xpp.jaxp11.SAXParserFactoryImpl PullParser2.1.10/src/java/drivers/jaxp11/org/0000755000175000017500000000000007755336260021127 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/0000755000175000017500000000000007755336260021713 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/xpp/0000755000175000017500000000000007755336260022522 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/xpp/jaxp11/0000755000175000017500000000000010232453172023610 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/xpp/jaxp11/DefaultValidationErrorHandler.java0000644000175000017500000001015707755336260032404 0ustar wbaerwbaer00000000000000/* based on xml.apache.org Xerces2*/ /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2000 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 "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, Sun Microsystems, Inc., * http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ //package org.apache.xerces.jaxp; package org.gjt.xpp.jaxp11; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; class DefaultValidationErrorHandler extends DefaultHandler { static private int ERROR_COUNT_LIMIT = 10; private int errorCount = 0; // XXX Fix message i18n public void error(SAXParseException e) throws SAXException { if (errorCount >= ERROR_COUNT_LIMIT) { // Ignore all errors after reaching the limit return; } else if (errorCount == 0) { // Print a warning before the first error System.err.println("Warning: validation was turned on but an org.xml.sax.ErrorHandler was not"); System.err.println("set, which is probably not what is desired. Parser will use a default"); System.err.println("ErrorHandler to print the first " + ERROR_COUNT_LIMIT + " errors. Please call"); System.err.println("the 'setErrorHandler' method to fix this."); } String systemId = e.getSystemId(); if (systemId == null) { systemId = "null"; } String message = "Error: URI=" + systemId + " Line=" + e.getLineNumber() + ": " + e.getMessage(); System.err.println(message); errorCount++; } } PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/xpp/jaxp11/SAXParserFactoryImpl.java0000644000175000017500000001412407755336260030455 0ustar wbaerwbaer00000000000000/* based on xml.apache.org Xerces2*/ /* * $Id: SAXParserFactoryImpl.java,v 1.1 2001/12/10 22:50:23 aslom Exp $ * * The Apache Software License, Version 1.1 * * * Copyright (c) 2000 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 "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, Sun Microsystems, Inc., * http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ //package org.apache.xerces.jaxp; package org.gjt.xpp.jaxp11; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParser; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import java.util.Hashtable; /** * @author Rajiv Mordani * @author Edwin Goei */ /** * This is the implementation specific class for the * javax.xml.parsers.SAXParserFactory. This is the platform * default implementation for the platform. */ public class SAXParserFactoryImpl extends SAXParserFactory { private Hashtable features; /** * Creates a new instance of SAXParser using the currently * configured factory parameters. * @return javax.xml.parsers.SAXParser */ public SAXParser newSAXParser() throws ParserConfigurationException { SAXParser saxParserImpl; try { saxParserImpl = new SAXParserImpl(this, features); } catch (SAXException se) { // Translate to ParserConfigurationException throw new ParserConfigurationException(se.getMessage()); } return saxParserImpl; } /** * Common code for translating exceptions */ private SAXParserImpl newSAXParserImpl() throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { SAXParserImpl saxParserImpl; try { saxParserImpl = new SAXParserImpl(this, features); } catch (SAXNotSupportedException e) { throw e; } catch (SAXNotRecognizedException e) { throw e; } catch (SAXException se) { throw new ParserConfigurationException(se.getMessage()); } return saxParserImpl; } /** * Sets the particular feature in the underlying implementation of * org.xml.sax.XMLReader. */ public void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { // XXX This is ugly. We have to collect the features and then // later create an XMLReader to verify the features. if (features == null) { features = new Hashtable(); } features.put(name, value ? Boolean.TRUE : Boolean.FALSE); // Test the feature by possibly throwing SAX exceptions try { newSAXParserImpl(); } catch (SAXNotSupportedException e) { features.remove(name); throw e; } catch (SAXNotRecognizedException e) { features.remove(name); throw e; } } /** * returns the particular property requested for in the underlying * implementation of org.xml.sax.XMLReader. */ public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { // Check for valid name by creating a dummy XMLReader to get // feature value return newSAXParserImpl().getXMLReader().getFeature(name); } } PullParser2.1.10/src/java/drivers/jaxp11/org/gjt/xpp/jaxp11/SAXParserImpl.java0000644000175000017500000001677607755336260027144 0ustar wbaerwbaer00000000000000/* based on xml.apache.org Xerces2*/ /* * $Id: SAXParserImpl.java,v 1.1 2001/12/10 22:50:23 aslom Exp $ * * The Apache Software License, Version 1.1 * * * Copyright (c) 2000 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 "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, Sun Microsystems, Inc., * http://www.sun.com. For more information on the Apache Software * Foundation, please see . */ //package org.apache.xerces.jaxp; package org.gjt.xpp.jaxp11; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.HandlerBase; import org.xml.sax.Parser; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderAdapter; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import java.util.*; /** * @author Rajiv Mordani * @author Edwin Goei */ /** * This is the implementation specific class for the * javax.xml.parsers.SAXParser. */ public class SAXParserImpl extends javax.xml.parsers.SAXParser { private XMLReader xmlReader; private Parser parser = null; private boolean validating = false; private boolean namespaceAware = false; /** * Create a SAX parser with the associated features * @param features Hashtable of SAX features, may be null */ SAXParserImpl(SAXParserFactory spf, Hashtable features) throws SAXException { // Instantiate a SAXParser directly and not through SAX so that we // use the right ClassLoader //xmlReader = new org.apache.xerces.parsers.SAXParser(); try { xmlReader = new org.gjt.xpp.sax2.Driver(); } catch(Exception ex) { throw new SAXException("could not create XPP2 driver for SAX2 "+ex, ex); } // Validation validating = spf.isValidating(); String validation = "http://xml.org/sax/features/validation"; // If validating, provide a default ErrorHandler that prints // validation errors with a warning telling the user to set an // ErrorHandler. Note: this does not handle all cases. if (validating) { xmlReader.setErrorHandler(new DefaultValidationErrorHandler()); } // Allow SAX parser to use a different ErrorHandler if it wants to xmlReader.setFeature(validation, validating); // "namespaceAware" == SAX Namespaces feature // Note: there is a compatibility problem here with default values: // JAXP default is false while SAX 2 default is true! namespaceAware = spf.isNamespaceAware(); String namespaces = "http://xml.org/sax/features/namespaces"; xmlReader.setFeature(namespaces, namespaceAware); setFeatures(features); } /** * Set any features of our XMLReader based on any features set on the * SAXParserFactory. * * XXX Does not handle possible conflicts between SAX feature names and * JAXP specific feature names, eg. SAXParserFactory.isValidating() */ private void setFeatures(Hashtable features) throws SAXNotSupportedException, SAXNotRecognizedException { if (features != null) { for (Enumeration e = features.keys(); e.hasMoreElements();) { String feature = (String)e.nextElement(); boolean value = ((Boolean)features.get(feature)).booleanValue(); xmlReader.setFeature(feature, value); } } } public Parser getParser() throws SAXException { if (parser == null) { // Adapt a SAX2 XMLReader into a SAX1 Parser parser = new XMLReaderAdapter(xmlReader); // Set a DocumentHandler that does nothing to avoid getting // exceptions if no DocumentHandler is set by the app parser.setDocumentHandler(new HandlerBase()); } return parser; } /** * Returns the XMLReader that is encapsulated by the implementation of * this class. */ public XMLReader getXMLReader() { return xmlReader; } public boolean isNamespaceAware() { return namespaceAware; } public boolean isValidating() { return validating; } /** * Sets the particular property in the underlying implementation of * org.xml.sax.XMLReader. */ public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { xmlReader.setProperty(name, value); } /** * returns the particular property requested for in the underlying * implementation of org.xml.sax.XMLReader. */ public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { return xmlReader.getProperty(name); } } PullParser2.1.10/src/java/drivers/jaxp11/README.txt0000644000175000017500000000013507755336265022042 0ustar wbaerwbaer00000000000000JAXP11 based on version included in Xerces2 but modified to use org.gjt.xpp.sax2.Driver PullParser2.1.10/src/java/drivers/sax2/0000755000175000017500000000000010232453172020073 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/sax2/org/0000755000175000017500000000000007755336260020700 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/sax2/org/gjt/0000755000175000017500000000000007755336260021464 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/sax2/org/gjt/xpp/0000755000175000017500000000000007755336260022273 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/sax2/org/gjt/xpp/sax2/0000755000175000017500000000000010232453172023132 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/drivers/sax2/org/gjt/xpp/sax2/Driver.java0000644000175000017500000004237207755336260025256 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ package org.gjt.xpp.sax2; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.Reader; // not J2ME classes import java.net.URL; import java.net.MalformedURLException; // not J2ME classes import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.StringReader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import org.xml.sax.Attributes; import org.xml.sax.DTDHandler; import org.xml.sax.ContentHandler; 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.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import org.gjt.xpp.*; public class Driver implements Locator, XMLReader, Attributes { protected static final String DECLARATION_HANDLER_PROPERTY = "http://xml.org/sax/properties/declaration-handler"; protected static final String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler"; protected static final String NAMESPACES_FEATURE = "http://xml.org/sax/features/namespaces"; protected static final String NAMESPACE_PREFIXES_FEATURE = "http://xml.org/sax/features/namespace-prefixes"; protected static final String VALIDATION_FEATURE = "http://xml.org/sax/features/validation"; protected static final String APACHE_SCHEMA_VALIDATION_FEATURE = "http://apache.org/xml/features/validation/schema"; protected static final String APACHE_DYNAMIC_VALIDATION_FEATURE = "http://apache.org/xml/features/validation/dynamic"; protected ContentHandler contentHandler; protected ErrorHandler errorHandler; protected String systemId; protected XmlPullParser pp; protected XmlEndTag etag; protected XmlStartTag stag; private final static boolean DEBUG = false; // use in parse sub-tree - exposed to resue more efficiently private char[] buf = new char[1024]; private String[] namespaces = new String[5]; private String[] prefixes = new String[5]; /** */ public Driver() throws XmlPullParserException { contentHandler = new DefaultHandler(); errorHandler = new DefaultHandler(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); pp = factory.newPullParser(); etag = factory.newEndTag(); stag = factory.newStartTag(); } // -- Attributes interface public int getLength() { return stag.getAttributeCount(); } public String getURI(int index) { return stag.getAttributeNamespaceUri(index); } public String getLocalName(int index) { return stag.getAttributeLocalName(index); } public String getQName(int index) { return stag.getAttributeRawName(index); } public String getType(int index) { return "CDATA"; } public String getValue(int index) { return stag.getAttributeValue(index); } public int getIndex(String uri, String localName) { for (int i = 0; i < stag.getAttributeCount(); i++) { if(stag.getAttributeNamespaceUri(i).equals(uri) && stag.getAttributeLocalName(i).equals(localName)) { return i; } } return -1; } public int getIndex(String qName) { for (int i = 0; i < stag.getAttributeCount(); i++) { if(stag.getAttributeRawName(i).equals(qName)) { return i; } } return -1; } public String getType(String uri, String localName) { return "CDATA"; } public String getType(String qName) { return "CDATA"; } public String getValue(String uri, String localName) { return stag.getAttributeValueFromName(uri, localName); } public String getValue(String qName) { return stag.getAttributeValueFromRawName(qName); } // -- Locator interface public String getPublicId() { return null; } public String getSystemId() { return systemId; } public int getLineNumber() { return pp.getLineNumber(); } public int getColumnNumber() { return pp.getColumnNumber(); } // --- XMLReader interface public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if(NAMESPACES_FEATURE.equals(name)) { return pp.isNamespaceAware(); } else if(NAMESPACE_PREFIXES_FEATURE.equals(name)) { return pp.isNamespaceAttributesReporting(); } else if(VALIDATION_FEATURE.equals(name)) { return false; } else if(APACHE_SCHEMA_VALIDATION_FEATURE.equals(name)) { return false; } else if(APACHE_DYNAMIC_VALIDATION_FEATURE.equals(name)) { return false; } else { throw new SAXNotRecognizedException("unrecognized feature "+name); } } public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { try { if(NAMESPACES_FEATURE.equals(name)) { pp.setNamespaceAware(value); } else if(NAMESPACE_PREFIXES_FEATURE.equals(name)) { pp.setNamespaceAttributesReporting(value); } else if(VALIDATION_FEATURE.equals(name)) { if(true == value) { throw new SAXNotSupportedException("validation is not supported"); } } else if(APACHE_SCHEMA_VALIDATION_FEATURE.equals(name)) { // can ignore as validation must be false ... // if(true == value) { // throw new SAXNotSupportedException("schema validation is not supported"); // } } else if(APACHE_DYNAMIC_VALIDATION_FEATURE.equals(name)) { if(true == value) { throw new SAXNotSupportedException("dynamic validation is not supported"); } } else { throw new SAXNotRecognizedException("unrecognized feature "+name); } } catch(XmlPullParserException ex) { throw new SAXNotSupportedException("problem with setting feature "+name+": "+ex); } } public Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if(DECLARATION_HANDLER_PROPERTY.equals(name)) { return null; } else if(LEXICAL_HANDLER_PROPERTY.equals(name)) { return null; } else { throw new SAXNotRecognizedException("not recognized get property "+name); } } public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { // if(DECLARATION_HANDLER_PROPERTY.equals(name)) { throw new SAXNotSupportedException("not supported setting property "+name);//+" to "+value); } else if(LEXICAL_HANDLER_PROPERTY.equals(name)) { throw new SAXNotSupportedException("not supported setting property "+name);//+" to "+value); } else { throw new SAXNotRecognizedException("not recognized set property "+name); } } public void setEntityResolver (EntityResolver resolver) {} public EntityResolver getEntityResolver () { return null; } public void setDTDHandler (DTDHandler handler) {} public DTDHandler getDTDHandler () { return null; } public void setContentHandler (ContentHandler handler) { this.contentHandler = handler; } public ContentHandler getContentHandler() { return contentHandler; } public void setErrorHandler(ErrorHandler handler) { this.errorHandler = handler; } public ErrorHandler getErrorHandler() { return errorHandler; } public void parse(InputSource source) throws SAXException, IOException { systemId = source.getSystemId(); contentHandler.setDocumentLocator(this); Reader reader = source.getCharacterStream(); if (reader == null) { InputStream stream = source.getByteStream(); String encoding = source.getEncoding(); if (stream == null) { systemId = source.getSystemId(); if(systemId == null) { SAXParseException saxException = new SAXParseException( "null source systemId" , this); errorHandler.fatalError(saxException); return; } try { URL url = new URL(systemId); stream = url.openStream(); } catch (MalformedURLException nue) { try { stream = new FileInputStream(systemId); } catch (FileNotFoundException fnfe) { SAXParseException saxException = new SAXParseException( "could not open file with systemId "+systemId, this, fnfe); errorHandler.fatalError(saxException); return; } } } if(encoding == null) { reader = new InputStreamReader(stream); } else { try { // TODO use more efficient reader for UTF8 encoding reader = new InputStreamReader(stream, encoding); } catch (UnsupportedEncodingException une) { SAXParseException saxException = new SAXParseException( "cant create input stream reader for encoding "+encoding, this, une); errorHandler.fatalError(saxException); return; } } } try { if(DEBUG) { StringWriter sw = new StringWriter(); char[] buf = new char[1024]; int i; while((i = reader.read(buf)) > 0) { sw.write(buf, 0, i); } String s = sw.toString(); System.out.println("read:---\n"+s+"---\n"); reader = new StringReader(s); } pp.setInput(reader); contentHandler.startDocument(); // get first event pp.next(); // it should be start tag... if(pp.getEventType() != pp.START_TAG) { SAXParseException saxException = new SAXParseException( "expected start tag not"+pp.getPosDesc(), this); //throw saxException; errorHandler.fatalError(saxException); return; } } catch (XmlPullParserException ex) { SAXParseException saxException = new SAXParseException( "parsing initialization error: "+ex, this, ex); //ex.printStackTrace(); errorHandler.fatalError(saxException); return; } parseSubTree(pp); contentHandler.endDocument(); } public void parse(String systemId) throws SAXException, IOException { parse(new InputSource(systemId)); } public void parseSubTree(XmlPullParser pp) throws SAXException, IOException { // if(false == pp.isNamespaceAware()) { // throw new SAXException("namespaces must be enabled"+pp.getPosDesc()); // } //pp.isNamespaceAware(); try { if(pp.getEventType() != pp.START_TAG) { throw new SAXException( "start tag must be read before skiping subtree"+pp.getPosDesc()); } // XmlPullParserEventPosition eventPosition = null; // if(pp instanceof XmlPullParserEventPosition) { // XmlPullParserEventPosition ep = (XmlPullParserEventPosition) pp; // // make sure it really works // try { // if(ep.getEventStart() != -1) { // eventPosition = ep; // } // } catch(Exception ex) { // } // } int level = 0; byte type = pp.START_TAG; LOOP: while(true) { switch(type) { case XmlPullParser.START_TAG: { pp.readStartTag(stag); int count = pp.getNamespacesLength(pp.getDepth()); if(count > 0) { if(namespaces.length < count) { namespaces = new String[count]; prefixes = new String[count]; } pp.readNamespacesPrefixes(pp.getDepth(), prefixes, 0, count); pp.readNamespacesUris(pp.getDepth(), namespaces, 0, count); for (int i = 0; i < count; i++) { contentHandler.startPrefixMapping(prefixes[i], namespaces[i]); } } contentHandler.startElement(stag.getNamespaceUri(), stag.getLocalName(), stag.getRawName(), this); ++level; } break; case XmlPullParser.CONTENT: // // this is very efficient zero copy - directly from tokenizer // if(eventPosition != null) { // int end = eventPosition.getEventEnd(); // int start = eventPosition.getEventStart(); // contentHandler.characters(eventPosition.getEventBuffer(), // start, end - start); // } else { String content = pp.readContent(); int len = content.length(); if(len > buf.length) { buf = new char[len]; } content.getChars(0, len, buf, 0); contentHandler.characters(buf, 0, len); // } break; case XmlPullParser.END_TAG: pp.readEndTag(etag); int count = pp.getNamespacesLength(pp.getDepth()); contentHandler.endElement(etag.getNamespaceUri(), etag.getLocalName(), etag.getRawName()); --level; if(count > 0) { if(namespaces.length < count) { namespaces = new String[count]; prefixes = new String[count]; } pp.readNamespacesPrefixes(pp.getDepth(), prefixes, 0, count); pp.readNamespacesUris(pp.getDepth(), namespaces, 0, count); for (int i = count - 1; i >= 0; i--) { contentHandler.endPrefixMapping(prefixes[i]); } } break; case XmlPullParser.END_DOCUMENT: break LOOP; } // if(level > 0) { // type = pp.next(); // } else { // break; // } type = pp.next(); } } catch (XmlPullParserException ex) { SAXParseException saxException = new SAXParseException("parsing error: "+ex, this, ex); errorHandler.fatalError(saxException); } } } PullParser2.1.10/src/java/drivers/sax2/README.txt0000644000175000017500000000006707755336265021617 0ustar wbaerwbaer00000000000000SAX2 driver that uses XPP2 API to implement XMLReader. PullParser2.1.10/src/java/impl/0000755000175000017500000000000010232453172016501 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/0000755000175000017500000000000007755336257020174 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/META-INF/0000755000175000017500000000000007755336257021334 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/META-INF/services/0000755000175000017500000000000010232453172023133 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/META-INF/services/org.gjt.xpp.XmlPullParserFactory0000644000175000017500000000005207755336257031360 0ustar wbaerwbaer00000000000000org.gjt.xpp.impl.PullParserFactoryFullImplPullParser2.1.10/src/java/impl/factory/org/0000755000175000017500000000000007755336257020763 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/org/gjt/0000755000175000017500000000000007755336257021547 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/org/gjt/xpp/0000755000175000017500000000000007755336257022356 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/org/gjt/xpp/impl/0000755000175000017500000000000010232453172023273 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/factory/org/gjt/xpp/impl/package.html0000644000175000017500000000040207755336265025573 0ustar wbaerwbaer00000000000000

    Constains reference implementation of Xml Pull Parser 2.0 (org.gjt.xpp). PullParser2.1.10/src/java/impl/factory/org/gjt/xpp/impl/PullParserFactoryFullImpl.java0000644000175000017500000001043707755336257031255 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: PullParserFactoryFullImpl.java,v 1.3 2003/04/06 00:03:57 aslom Exp $ */ package org.gjt.xpp.impl; import org.gjt.xpp.*; import org.gjt.xpp.impl.format.Formatter; import org.gjt.xpp.impl.format.Recorder; import org.gjt.xpp.impl.node.Node; import org.gjt.xpp.impl.pullnode.PullNode; import org.gjt.xpp.impl.pullparser.PullParser; import org.gjt.xpp.impl.tag.EndTag; import org.gjt.xpp.impl.tag.StartTag; /** * Implementation of Pull Parser Factory. * * @author Aleksande Slominski */ public class PullParserFactoryFullImpl extends XmlPullParserFactory { public XmlPullParser newPullParser() throws XmlPullParserException { XmlPullParser pp = new PullParser(); pp.setNamespaceAware(isNamespaceAware()); return pp; } public XmlEndTag newEndTag() { return new EndTag(); } public XmlNode newNode() { return new Node(); } public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException { return new PullNode(pp); } public XmlStartTag newStartTag() { return new StartTag(); } public XmlFormatter newFormatter() throws XmlPullParserException { return new Formatter(); } public XmlRecorder newRecorder() { return new Recorder(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/format/0000755000175000017500000000000007755336257020015 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/0000755000175000017500000000000007755336257020604 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/gjt/0000755000175000017500000000000007755336257021370 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/gjt/xpp/0000755000175000017500000000000007755336257022177 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/gjt/xpp/impl/0000755000175000017500000000000007755336257023140 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/gjt/xpp/impl/format/0000755000175000017500000000000010232453172024404 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/format/org/gjt/xpp/impl/format/Formatter.java0000644000175000017500000001012607755336257027236 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Formatter.java,v 1.4 2003/04/06 00:03:57 aslom Exp $ */ package org.gjt.xpp.impl.format; import java.io.IOException; import java.util.Enumeration; import org.gjt.xpp.*; /** * Implementatin of Recorder that is simply writing XML to output sink. * * @author Aleksander Slominski */ public class Formatter extends Recorder implements XmlFormatter { private boolean endTagNewLine; public Formatter() { } public boolean isEndTagNewLine() { return endTagNewLine; } /** * Should new line be added after end tag? */ public void setEndTagNewLine(boolean enable) { endTagNewLine = enable; } public void writeEndTag(XmlEndTag etag) throws IOException, XmlPullParserException { super.writeEndTag(etag); if(endTagNewLine) { out.write("\n"); } } public void writeStartTagAsEndTag(XmlStartTag stag) throws IOException, XmlPullParserException { super.writeStartTagAsEndTag(stag); if(endTagNewLine) { out.write("\n"); } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/format/org/gjt/xpp/impl/format/Recorder.java0000644000175000017500000002261107755336257027042 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Recorder.java,v 1.4 2003/04/06 00:03:57 aslom Exp $ */ package org.gjt.xpp.impl.format; import java.io.*; import java.util.Enumeration; import org.gjt.xpp.*; /** * Implementatin of Recorder that is simply writing XML to output sink. * * @author Aleksander Slominski */ public class Recorder implements XmlRecorder { protected String[] declaredPrefixes; protected String[] declaredNs; protected Writer out; public Recorder() { } public Writer getOutput() { return out; } public void setOutput(Writer out) { this.out = out; } public void write(Object o) throws IOException, XmlPullParserException { // order of check *is* important if(o instanceof XmlNode) { writeNode((XmlNode)o); } else if(o instanceof XmlStartTag) { writeStartTag((XmlStartTag)o); } else if(o instanceof XmlEndTag) { writeEndTag((XmlEndTag)o); } else if(o instanceof XmlWritable) { ((XmlWritable)o).writeXml(out); } else { if(o != null) { writeContent(o.toString()); } else { //silenty ignore null values } } } public void writeXml(XmlWritable w) throws IOException, XmlPullParserException { w.writeXml(out); } public void writeContent(String s) throws IOException, XmlPullParserException { if(s == null) { throw new XmlPullParserException( "null string can not be written as XML element content"); } writeEscaped(s, false); } public void writeEndTag(XmlEndTag etag) throws IOException, XmlPullParserException { if(etag.getRawName() == null) { throw new XmlPullParserException( "raw name of XML element can not be null"); } out.write("'); } public void writeStartTag(XmlStartTag stag) throws IOException, XmlPullParserException { writeStartTagStart(stag); out.write('>'); } public void writeStartTagStart(XmlStartTag stag) throws IOException, XmlPullParserException { if(stag.getRawName() == null) { throw new XmlPullParserException( "raw name of XML element can not be null"); } out.write('<'); out.write(stag.getRawName()); // print all attributes for (int i = 0; i < stag.getAttributeCount(); i++) { if(stag.isAttributeNamespaceDeclaration(i) == false) { out.write(' '); out.write(stag.getAttributeRawName(i)); out.write("='"); writeEscaped(stag.getAttributeValue(i), true); out.write('\''); } } } public void writeStartTagAsEndTag(XmlStartTag stag) throws IOException, XmlPullParserException { if(stag.getRawName() == null) { throw new XmlPullParserException( "raw name of XML end tag can not be null"); } out.write("'); } public void writeNode(XmlNode node) throws IOException, XmlPullParserException { writeStartTagStart(node); // print namespace declarations - if any int len = node.getDeclaredNamespaceLength(); if(len > 0) { if(declaredNs == null || len > declaredNs.length) { int newLen = len + 10; String[] newDeclaredPrefixes = new String[newLen]; String[] newDeclaredNs = new String[newLen]; int oldLen = declaredNs != null ? declaredNs.length : 0; for(int i = 0; i < oldLen; ++i) { newDeclaredPrefixes[i] = declaredPrefixes[i]; newDeclaredNs[i] = declaredNs[i]; } declaredPrefixes = newDeclaredPrefixes; declaredNs = newDeclaredNs; } node.readDeclaredPrefixes(declaredPrefixes, 0, len); node.readDeclaredNamespaceUris(declaredNs, 0, len); for (int i = 0; i < len; i++) { out.write(" xmlns:"); out.write(declaredPrefixes[i]); out.write("='"); writeEscaped(declaredNs[i], true); out.write('\''); } } // write default namespace declaration if necessary ... // XmlNode parent = node.getParent(); String defaultUri = node.getDefaultNamespaceUri(); // if(defaultUri != null // && (parent == null // || ! defaultUri.equals(parent.getDefaultNamespaceUri()) // ) // ) if(defaultUri != null) { XmlNode parent = node.getParentNode(); if((parent != null && ! defaultUri.equals(parent.getDefaultNamespaceUri())) || (parent == null && ! "".equals(defaultUri)) ) { out.write(" xmlns='"); writeEscaped(defaultUri, true); out.write('\''); } } // out.write('>'); // for each children - print it //Enumeration enum = node.children(); boolean hadChildren = false; //while (enum.hasMoreElements()) int childCount = node.getChildrenCount(); for(int i = 0; i < childCount; ++i) { Object o = node.getChildAt(i);//enum.nextElement(); // do not output null or empty string "" nodes if(o == null // || (o instanceof String && o.toString().length() == 0) ) { continue; } if(!hadChildren) { hadChildren = true; out.write('>'); } write(o); } if(hadChildren) { writeStartTagAsEndTag(node); } else { out.write("/>"); } } protected void writeEscaped(String s, boolean escapeApostAttrib) throws IOException, XmlPullParserException { int pos = 0; int i = 0; int len = s.length(); for (; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write("<"); break; case '\r': if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write(" "); break; case '&': if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write("&"); break; // preserve (#x20, #xD, #xA, #x9) ptherwise normalized to #x20 // as described in XML1.0 3.3.3 Attribute-Value Normalization case '\t': if(escapeApostAttrib) { if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write(" "); } break; case '\n': if(escapeApostAttrib) { if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write(" "); } break; // this recorder writes attributes enclosed in apostrophes // thereofre apostrophe in attrib value must be escaped case '\'': if(escapeApostAttrib) { if(i > pos) out.write(s, pos, i - pos); pos = i + 1; out.write("'"); } break; } } if(pos == 0) { out.write(s); } else { out.write(s, pos, i - pos); } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/node/0000755000175000017500000000000007755336257017452 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/0000755000175000017500000000000007755336257020241 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/0000755000175000017500000000000007755336257021025 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/xpp/0000755000175000017500000000000007755336257021634 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/0000755000175000017500000000000007755336257022575 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/node/0000755000175000017500000000000010232453172023476 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/node/Node.java0000644000175000017500000005314407755336257025261 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Node.java,v 1.10 2003/04/29 20:57:34 aslom Exp $ */ package org.gjt.xpp.impl.node; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import org.gjt.xpp.XmlNode; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.impl.tag.PullParserRuntimeException; import org.gjt.xpp.impl.tag.StartTag; //TODO: check for clearing reference when removing children /** * Encapsulate XML Node with list of associated children and namespaces :-). * * @author Aleksander Slominski */ public class Node extends StartTag implements XmlNode { protected static final Enumeration EMPTY_ENUMERATION = new EmptyEnumerator(); protected Vector children; protected int childrenCount; protected Object oneChild; protected XmlNode parent; //protected int parentMyPos; protected String defaultNamespaceUri; protected Hashtable prefix2Ns; protected int declaredNsEnd; protected String[] declaredNs; protected String[] declaredPrefixes; public boolean equals(Object o) { if(o == null) return false; if(! (o instanceof Node) ) return false; Node node = (Node) o; if(childrenCount != node.childrenCount) return false; if(childrenCount == 1) { if(! oneChild.equals(node.oneChild)) { return false; } } else { for (int i = 0; i < childrenCount; i++) { if(! children.elementAt(i).equals(node.children.elementAt(i))) { return false; } } } String u = defaultNamespaceUri; if(u == null) u = ""; String nodeU = node.defaultNamespaceUri; if(nodeU == null) nodeU = ""; if( ! u.equals(nodeU)) { return false; } // if(declaredNsEnd != node.declaredNsEnd) return false; // for (int i = 0; i < declaredNsEnd; i++) { // if((!declaredNs[i].equals(node.declaredNs[i]) ) // && (!declaredPrefixes[i].equals(node.declaredPrefixes[i]) ) ) { // return false; // } // } return super.equals(o); } public Node() { } public void resetNode() { super.resetStartTag(); parent = null; childrenCount = 0; oneChild = null; if(children != null) { children.removeAllElements(); } removeDeclaredNamespaces(); //parentMyPos = -1; } /** context sensitive factory method to create the same type of node */ public XmlNode newNode() throws XmlPullParserException { return new Node(); } public XmlNode newNode(String namespaceUri, String localName) throws XmlPullParserException { XmlNode node = new Node(); String prefix = namespace2Prefix(namespaceUri); if(prefix == null) { throw new XmlPullParserException( "namespace '"+namespaceUri+"' has no prefix declared in node tree"); } node.modifyTag(namespaceUri, localName, ("".equals(prefix) ? localName : prefix+':'+localName) ); return node; } public XmlNode getParentNode() { return parent; } public Enumeration children() { if(childrenCount == 0) { return EMPTY_ENUMERATION; } else if(childrenCount == 1) { return new OneChildEnumerator(oneChild); } else { return children.elements(); } } /** it may need to reconsruct whole subtree to get count ... */ public int getChildrenCount() { return childrenCount; } public Object getChildAt(int pos) { if(childrenCount > 0) { if(pos == 0 && childrenCount == 1) { return oneChild; } else if(pos < childrenCount) { return children.elementAt(pos); } else { throw new IllegalArgumentException( "no child at position "+pos); } } else { throw new IllegalArgumentException( "this node has no children"); } } // ---------------- modifiable public void setParentNode(XmlNode parent) { this.parent = parent; } public void appendChild(Object child) throws XmlPullParserException { if(childrenCount == 0) { oneChild = child; } else { //childrenCount > 0 if(children == null) { children = new Vector(4, 4); } if(childrenCount == 1) { if(children.size() > 0) { children.removeAllElements(); } children.addElement(oneChild); oneChild = null; } children.addElement(child); } if(child instanceof XmlNode) { ((XmlNode)child).setParentNode(this); } ++childrenCount; } public void insertChildAt(int pos, Object child) throws XmlPullParserException { if(childrenCount == 0) { if(pos != 0) { throw new XmlPullParserException( "to insert first child position must be 0 not "+pos); } oneChild = child; } else { if(children == null) { children = new Vector(4, 4); } if(childrenCount == 1) { if(children.size() > 0) { children.removeAllElements(); } children.addElement(oneChild); } children.insertElementAt(child, pos); } if(child instanceof XmlNode) { ((XmlNode)child).setParentNode(this); } ++childrenCount; } public void removeChildAt(int pos) throws XmlPullParserException { Object removedChild = null; if(childrenCount == 0) { throw new XmlPullParserException( "node has no children to remove"); } else if(childrenCount == 1) { if(pos != 0) { throw new XmlPullParserException( "to remove last child position must be 0 not "+pos); } removedChild = oneChild; oneChild = null; } else if(childrenCount == 2) { if(pos == 0) { oneChild = children.elementAt(1); removedChild = children.elementAt(0); } else if(pos == 1) { oneChild = children.elementAt(0); removedChild = children.elementAt(1); } else { throw new XmlPullParserException( "only two children position must 0 or 1 but not "+pos); } children.removeAllElements(); } else { removedChild = children.elementAt(pos); children.removeElementAt(pos); } if(removedChild instanceof XmlNode) { ((XmlNode)removedChild).setParentNode(null); } --childrenCount; } public void replaceChildAt(int pos, Object child) throws XmlPullParserException { if(childrenCount == 1) { if(pos != 0) { throw new XmlPullParserException( "to set first child position must be 0 not "+pos); } oneChild = child; } else if(childrenCount > 1) { children.setElementAt(child, pos); } else { throw new XmlPullParserException( "node must have at least one children to set child at "+pos); } if(child instanceof XmlNode) { ((XmlNode)child).setParentNode(this); } } public void ensureChildrenCapacity(int minCapacity) throws XmlPullParserException { if(minCapacity <= 1) return; if(children == null) { children = new Vector(minCapacity, 4); } else { children.ensureCapacity(minCapacity); } } public void removeChildren() throws XmlPullParserException { // un-parent all children if(childrenCount == 1 && oneChild instanceof XmlNode) { ((XmlNode)oneChild).setParentNode(null); } oneChild = null; if(children != null && children.size() > 0) { Enumeration enum = children.elements(); while (enum.hasMoreElements()) { Object child = enum.nextElement(); if(child instanceof XmlNode) { ((XmlNode)child).setParentNode(null); } } children.removeAllElements(); } childrenCount = 0; } // ---------------- namespace related methods -- pain... //NOTE: this is initialized based on "namespace" xmlns attributes... public String getQNameLocal(String qName) { int i = qName.lastIndexOf(':'); return qName.substring(i + 1); } public String getQNameUri(String qName) { int i = qName.lastIndexOf(':'); if(i > 0) { String prefix = qName.substring(0, i); try { return prefix2Namespace(prefix); } catch(XmlPullParserException ex) { throw new PullParserRuntimeException(ex); } } else { return defaultNamespaceUri; } } public String prefix2Namespace(String prefix) throws XmlPullParserException { if(prefix == null) { return null; } if("".equals(prefix)) { return defaultNamespaceUri; } String namespaceUri = null; if(declaredNsEnd > 0) { if(prefix2Ns == null) { //populatePrefix2Ns(); prefix2Ns = new Hashtable(); for (int i = 0; i < declaredNsEnd; i++) { prefix2Ns.put(declaredPrefixes[i], declaredNs[i]); } } namespaceUri = (String) prefix2Ns.get(prefix); } if(parent != null && namespaceUri == null) { return parent.prefix2Namespace(prefix); } return namespaceUri; } public String namespace2Prefix(String namespaceUri) throws XmlPullParserException { if(namespaceUri == null) { throw new XmlPullParserException("null is not allowed for namespace name"); } if(namespaceUri.equals(getDefaultNamespaceUri())) { return ""; } for(int i = 0 ; i < declaredNsEnd; ++i) { if(namespaceUri.equals(declaredNs[i])) { return declaredPrefixes[i]; } } if(parent != null) { return parent.namespace2Prefix(namespaceUri); } else { return null; } } public String getDefaultNamespaceUri() { return defaultNamespaceUri; } public void setDefaultNamespaceUri(String defaultNamespaceUri) { this.defaultNamespaceUri = defaultNamespaceUri; } public int getDeclaredNamespaceLength() { return declaredNsEnd; } public void readDeclaredNamespaceUris(String[] uris, int off, int len) { if(len > declaredNsEnd) throw new IllegalArgumentException( "this node has only "+declaredNsEnd+" namespace URIs and not "+len); if(declaredNs != null) { System.arraycopy(declaredNs, 0, uris, off, len); } // Enumeration enum = prefix2Ns.keys(); // int i = off; // while (enum.hasMoreElements() && i < off + len) // { // uris[i++] = (String) prefix2Ns.get( enum.nextElement() ); // } } public void readDeclaredPrefixes(String[] prefixes, int off, int len) { if(len > declaredNsEnd) throw new IllegalArgumentException( "this node has only "+declaredNsEnd+" prefixes and nor "+len); if(declaredPrefixes != null) { System.arraycopy(declaredPrefixes, 0, prefixes, off, len); } } public void ensureDeclaredNamespacesCapacity(int minCapacity) { if(declaredNs == null || declaredNs.length < minCapacity) { String[] newDeclaredNs = new String[minCapacity]; String[] newDeclaredPrefixes = new String[minCapacity]; if(declaredNsEnd > 0) { System.arraycopy( declaredNs, 0, newDeclaredNs, 0, declaredNsEnd); System.arraycopy( declaredPrefixes, 0, newDeclaredPrefixes, 0, declaredNsEnd); } declaredNs = newDeclaredNs; declaredPrefixes = newDeclaredPrefixes; } } public void addNamespaceDeclaration(String prefix, String namespaceUri) throws XmlPullParserException { if(prefix2Ns != null) { Object exisitingNs = prefix2Ns.get(prefix); if(exisitingNs != null) { throw new IllegalArgumentException( "prefix '"+prefix+"' already bound to '"+exisitingNs +"' (and can not be rebound to '"+namespaceUri+"'"); } } ensureDeclaredNamespacesCapacity(declaredNsEnd + 1); declaredNs[declaredNsEnd] = namespaceUri; declaredPrefixes[declaredNsEnd] = prefix; declaredNsEnd++; if(prefix2Ns != null) { prefix2Ns.put(prefix, namespaceUri); } } public void addDeclaredNamespaces( String[] prefix, int off, int len, String[] namespaceUri) { if(len == 0) return; // assert len > 0 if(len < 0) throw new IllegalArgumentException( "number of added namespaces can not be negative"); if(prefix2Ns != null) { for (int i = 0; i < prefix.length; i++) { String pref = prefix[i]; Object exisitingNs = prefix2Ns.get(pref); if(exisitingNs != null) { throw new IllegalArgumentException( "prefix '"+pref+"' already bound to '"+exisitingNs +"' (and can not be rebound to '"+namespaceUri[i]+"'"); } } } ensureDeclaredNamespacesCapacity(declaredNsEnd + len); System.arraycopy( namespaceUri, off, declaredNs, declaredNsEnd, len); System.arraycopy( prefix, off, declaredPrefixes, declaredNsEnd, len); declaredNsEnd += len; // for(int i = off; i < off + len; i++) { // System.err.println("adding"+ // " prefix["+i+"] = "+prefix[i]+ // " namespaceUri["+i+"] = "+namespaceUri[i]); // } if(prefix2Ns != null) { for(int i = off; i < off + len; i++) { // TODO: assert both are not null... prefix2Ns.put(prefix[i], namespaceUri[i]); } } } public void removeDeclaredNamespaces() { // if(prefix2Ns != null) { // prefix2Ns.clear(); // } prefix2Ns = null; declaredNsEnd = 0; defaultNamespaceUri = null; } /** * Print into StringBuffer element name */ protected void printFields(StringBuffer buf) { super.printFields(buf); buf.append(" children=[ "); if(childrenCount == 0) { buf.append(""); } else if(childrenCount == 1) { buf.append("'"); buf.append(oneChild); buf.append("'"); } else if(children != null) { for(int i = 0; i < children.size(); ++i) { buf.append('\''); buf.append(children.elementAt(i)); buf.append("', "); } } buf.append(" ]"); XmlNode parent = getParentNode(); String defaultUri = getDefaultNamespaceUri(); if(defaultUri != null && (parent == null || ! defaultUri.equals(parent.getDefaultNamespaceUri()) ) ) { buf.append(" xmlns='"); buf.append(defaultUri); buf.append('\''); } if(declaredNsEnd > 0) { buf.append(" namespaces = ["); for(int i = 0; i < declaredNsEnd; ++i) { buf.append(" xmlns:"); buf.append(declaredPrefixes[i]); buf.append("='"); buf.append(declaredNs[i]); buf.append("'"); } // Enumeration enum = prefix2Ns.keys(); // while (enum.hasMoreElements()) // { // Object key = enum.nextElement(); // buf.append("xmlns:"); // buf.append(key); // buf.append("='"); // buf.append(prefix2Ns.get( key )); // buf.append("'"); // } buf.append(" ]"); } } /** * Return string representation of start tag including name * and list of attributes. */ public String toString() { StringBuffer buf = new StringBuffer("Node={"); printFields(buf); buf.append(" }"); return buf.toString(); } /** Special enumeration that will enumerate just one element ... */ } class OneChildEnumerator implements Enumeration { Object oneChild; OneChildEnumerator(Object value) { oneChild = value; } public boolean hasMoreElements() { return oneChild != null; } public Object nextElement() { if(oneChild != null) { Object value = oneChild; oneChild = null; return value; } else { throw new PullParserRuntimeException( "trying to access elements beyond enb of enumeration"); } } } class EmptyEnumerator implements Enumeration { public boolean hasMoreElements() { return false; } public Object nextElement() { throw new PullParserRuntimeException( "trying to access elements beyond enbd of enumeration"); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/pullnode/0000755000175000017500000000000010232453172024373 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/pullnode/PullNode.java0000644000175000017500000004306407755336257027013 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: PullNode.java,v 1.7 2003/04/06 00:03:57 aslom Exp $ */ package org.gjt.xpp.impl.pullnode; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import java.io.IOException; import org.gjt.xpp.XmlNode; import org.gjt.xpp.XmlPullNode; import org.gjt.xpp.XmlPullParser; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.impl.tag.PullParserRuntimeException; import org.gjt.xpp.impl.node.Node; /** * Allows node tree to be constructed on demand. * When PullNode is constructed and method setPullPasrser() is * executed (or constructor with PullParser arg is called) * node is assumend to be incomplete and children will be * retrieved on demand (pulled) including automatic creation of * sub pull nodes. If no pull parser is associated (it is null) * this class must work like regular XmlNode... * * @author Aleksander Slominski */ public class PullNode extends Node implements XmlPullNode { protected int depth; protected XmlPullParser pp; public PullNode(XmlPullParser pp) throws XmlPullParserException { setPullParser(pp); } public XmlNode newNode() throws XmlPullParserException { return new PullNode(null); } public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException { return new PullNode(pp); } /** PullNode stays in finished state. */ public void resetPullNode() { if(pp != null) { readChildrenFullySafe(Integer.MAX_VALUE); } super.resetNode(); depth = -1; } public boolean isFinished() { return pp == null; } // returned pull parser will be before possible start tag of the child // next() will must return START_TAG or END_TAG if end of children public XmlPullParser getPullParser() throws IOException, XmlPullParserException { if(pp == null) { throw new XmlPullParserException( "Pull node is complete and no pull parser can be returned"); } int currentDepth = pp.getDepth(); if(currentDepth >= depth + 1) { // parsing deep in another element Object lastChild = getChildAt(childrenCount - 1); if(lastChild instanceof XmlPullNode) { ((XmlPullNode) lastChild).readChildren(); currentDepth = pp.getDepth(); } else { throw new XmlPullParserException( "underlying pull parser is in incosistent state " +"depth is "+currentDepth+" instead of "+depth +pp.getPosDesc()); } } if(currentDepth == depth + 1) { if(pp.getEventType() != XmlPullParser.END_TAG) { throw new XmlPullParserException( "underlying pull parser is in incosistent state " +" it should be on end tag of last node " +" but it is at "+pp.getPosDesc()); } } else if(currentDepth == depth) { // must be on initial start tag if(pp.getEventType() != XmlPullParser.START_TAG) { throw new XmlPullParserException( "underlying pull parser is in incosistent state " +" it should be on start tag of this node "+getRawName() +" but it is at "+pp.getPosDesc()); } } else { throw new XmlPullParserException( "underlying pull parser is in incosistent state " +" it is above current node "+getRawName() +" currently at "+pp.getPosDesc()); } XmlPullParser hold = pp; pp = null; return hold; } /** Reset pull node to use pull parser. Pull Parser must be on START_TAG */ public void setPullParser(XmlPullParser pp) throws XmlPullParserException { super.resetNode(); //super.removeChildren(); this.pp = pp; this.depth = -1; if(pp == null) { return; } if(pp.getEventType() != XmlPullParser.START_TAG) { throw new XmlPullParserException( "parser must be at START_TAG to create pull node" +pp.getPosDesc() ); } this.depth = pp.getDepth(); pp.readNodeWithoutChildren(this); } public Enumeration children() { if(pp != null) { //handle dynamic reading of children return new PullNodeEnumerator(this); } else { return super.children(); } } public Object readNextChild() throws XmlPullParserException, IOException { if(pp == null) { //throw new XmlPullParserException("no pull parser available"); return null; } // make sure that last child is fully constructed if(childrenCount > 0) { Object lastChild = getChildAt(childrenCount - 1); if(lastChild instanceof XmlPullNode) { ((XmlPullNode) lastChild).readChildren(); } } //while(true) { byte state = pp.next(); if(state == XmlPullParser.START_TAG) { // double check depth!!!! if(pp.getDepth() != depth + 1) { throw new XmlPullParserException( "expected start tag at depth "+(depth + 1)+" not "+pp.getDepth() +pp.getPosDesc()); } XmlPullNode newChild = newPullNode(pp); //pp.readNodeWithoutChildren(newChild); //if(DEBUG) System.err.println("adding node="+newChild+" count="+childrenCount); super.appendChild(newChild); return newChild; } else if(state == XmlPullParser.CONTENT) { // double check depth!!!! if(pp.getDepth() != depth) { throw new XmlPullParserException( "expected content at depth "+depth+" not "+pp.getDepth() +pp.getPosDesc()); } // only add element content if not empty string "" //if(pp.getEventEnd() > pp.getEventStart()) { String content = pp.readContent(); //if(DEBUG) System.err.println("adding content="+content+" count="+childrenCount); super.appendChild(content); return content; //} // continue looking for other than empty string children //continue; } else if(state == XmlPullParser.END_TAG) { // double check depth!!!! if(pp.getDepth() != depth) { throw new XmlPullParserException( "expected end tag at depth "+depth+" not "+pp.getDepth() +pp.getPosDesc()); } pp = null; return null; } else if(state == XmlPullParser.END_DOCUMENT) { throw new XmlPullParserException( "pull node could not be built - embedded pull parser" +" was accessed and already finished parsing" +pp.getPosDesc()); } else { throw new XmlPullParserException( "unexpected pull parser event "+state+pp.getPosDesc()); } //} } /** * Read all reminaing children up to end tag. */ public void readChildren() throws XmlPullParserException, IOException { readChildren(Integer.MAX_VALUE); } /** * Read all reminaing children up to pos -1 and start tag at pos. */ private void readChildren(int pos) throws XmlPullParserException, IOException { if(pp == null) return; while(childrenCount - 1 < pos) { if(readNextChild() == null) { pp = null; break; } } // assert (incomplete && childrenCount -1 == pos) || !incomplete } private void readChildrenFullySafe(int pos) { if(pp == null) return; try { readChildren(pos); // make sure that current child is fully constructed if(pp != null && childrenCount > 0) { Object lastChild = getChildAt(childrenCount - 1); if(lastChild instanceof XmlPullNode) { ((XmlPullNode) lastChild).readChildren(); } } } catch(XmlPullParserException ex) { throw new PullParserRuntimeException(ex); } catch(IOException ex) { throw new PullParserRuntimeException(ex); } } private void readChildrenPartialSafe(int pos) { try { readChildren(pos); } catch(XmlPullParserException ex) { throw new PullParserRuntimeException(ex); } catch(IOException ex) { throw new PullParserRuntimeException(ex); } } public void skipChildren() throws XmlPullParserException, IOException { if(pp == null) return; // for last node call skipChildren() if(childrenCount > 0) { Object lastChild = getChildAt(childrenCount - 1); if(lastChild instanceof XmlPullNode) { ((XmlPullNode) lastChild).skipChildren(); } } while(true) { // double check depth!!!! byte event = pp.next(); if(event == XmlPullParser.START_TAG) { if(pp.getDepth() != depth + 1) { throw new XmlPullParserException( "expected start tag at depth "+(depth + 1)+" not "+pp.getDepth() +pp.getPosDesc()); } pp.skipNode(); } else if(event == XmlPullParser.CONTENT) { ; // ignore it } else if(event == XmlPullParser.END_TAG) { if(pp.getDepth() != depth) { throw new XmlPullParserException( "expected end tag at depth "+depth+" not "+pp.getDepth() +pp.getPosDesc()); } pp = null; break; } else { throw new XmlPullParserException( "unexpected parser event "+event+pp.getPosDesc()); } } // use pp.skipNode for all remaining children pp = null; } /** if unfinished it returns actual number of children... */ public int getChildrenCountSoFar() { return childrenCount; } /** it will reconsruct whole subtree to get count ... */ public int getChildrenCount() { if(pp != null) { readChildrenFullySafe(Integer.MAX_VALUE); } return childrenCount; } public Object getChildAt(int pos) { if(pp != null && pos >= childrenCount ) { readChildrenPartialSafe(pos); } return super.getChildAt(pos); } // ---------------- modifiable public void appendChild(Object child) throws XmlPullParserException { if(pp != null) { readChildrenFullySafe(Integer.MAX_VALUE); } super.appendChild(child); } public void insertChildAt(int pos, Object child) throws XmlPullParserException { if(pp != null && pos >= childrenCount ) { //TODO: make sure that it is safe to do partial read!!!! readChildrenPartialSafe(pos); } super.insertChildAt(pos, child); } public void removeChildAt(int pos) throws XmlPullParserException { if(pp != null && pos >= childrenCount ) { readChildrenFullySafe(pos); } super.removeChildAt(pos); } public void replaceChildAt(int pos, Object child) throws XmlPullParserException { if(pp != null && pos >= childrenCount ) { readChildrenFullySafe(pos); } super.replaceChildAt(pos, child); } public void removeChildren() throws XmlPullParserException { if(pp != null) { try{ skipChildren(); } catch(IOException ex) { throw new PullParserRuntimeException( "removeChildren(): could not skip children", ex); } } super.removeChildren(); } /** * Print this class state into StringBuffer element name */ protected void printFields(StringBuffer buf) { //buf.append(" incomplete="+(pp != null)); buf.append(" pp="+pp); buf.append(" depth="+depth); super.printFields(buf); } /** * Return string representation of start tag including name * and list of attributes. */ public String toString() { StringBuffer buf = new StringBuffer("PullNode={"); printFields(buf); buf.append(" }"); return buf.toString(); } } class PullNodeEnumerator implements Enumeration { XmlPullNode node; int pos; PullNodeEnumerator(XmlPullNode node) { this.node = node; pos = 0; } public boolean hasMoreElements() { if(node.isFinished()) { return pos < node.getChildrenCount(); } else { int countSoFar = node.getChildrenCountSoFar(); if(pos < countSoFar) return true; try { // read children until pos is achieved or end while(true) { Object value = node.readNextChild(); if(value != null) { ++countSoFar; if(pos == countSoFar - 1) return true; } else { return false; } } } catch(XmlPullParserException ex) { throw new PullParserRuntimeException( "next value could not be read ", ex); } catch(IOException ex) { throw new PullParserRuntimeException( "next value could not be read ", ex); } } } public Object nextElement() { return node.getChildAt(pos++); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/pullparser/0000755000175000017500000000000007755336257020716 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/0000755000175000017500000000000007755336257021505 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/0000755000175000017500000000000007755336257022271 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/0000755000175000017500000000000007755336257023100 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/0000755000175000017500000000000007755336257024041 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/pullparser/0000755000175000017500000000000010232453172026206 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/pullparser/ElementContent.java0000644000175000017500000001117707755336257032030 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: ElementContent.java,v 1.4 2003/04/06 00:03:58 aslom Exp $ */ package org.gjt.xpp.impl.pullparser; import org.gjt.xpp.XmlNode; /** * Utility class to keep information about XML element such as name etc. * and if namespaces enabled also list of declared prefixes and * previous values of prefixes namespace uri * (to restore them in ns hashtbale) */ public class ElementContent { private final static boolean TRACE_SIZING = false; String qName; //char qNameBuf[]; String uri; String localName; String prefix; String defaultNs; int prefixesEnd; int prefixesSize; String[] prefixes; String[] namespaceURIs; String[] prefixPrevNs; // just to optimize readNode XmlNode node; ElementContent() { } void ensureCapacity(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 if(prefixesSize < newSize) { if(TRACE_SIZING) { System.err.println("prefixesEnd "+prefixesEnd+" ==> "+newSize); } String[] newPrefixes = new String[newSize]; String[] newNamespaceURIs = new String[newSize]; String[] newPrefixPrevNs = new String[newSize]; if(prefixes != null) { System.arraycopy( prefixes, 0, newPrefixes, 0, prefixesEnd); System.arraycopy( namespaceURIs, 0, newNamespaceURIs, 0, prefixesEnd); System.arraycopy( prefixPrevNs, 0, newPrefixPrevNs, 0, prefixesEnd); } prefixes = newPrefixes; namespaceURIs = newNamespaceURIs; prefixPrevNs = newPrefixPrevNs; prefixesSize = newSize; } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/pullparser/PullParser.java0000644000175000017500000015272107755336257031176 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: PullParser.java,v 1.12 2003/10/21 23:38:54 aslom Exp $ */ package org.gjt.xpp.impl.pullparser; import java.io.*; import java.util.Hashtable; import java.util.Stack; import org.gjt.xpp.XmlEndTag; import org.gjt.xpp.XmlPullParser; import org.gjt.xpp.XmlPullParserBufferControl; import org.gjt.xpp.XmlPullParserEventPosition; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.XmlStartTag; import org.gjt.xpp.XmlNode; // some code sharing import org.gjt.xpp.impl.tag.Attribute; import org.gjt.xpp.impl.tag.PullParserRuntimeException; import org.gjt.xpp.impl.tokenizer.Tokenizer; /** * XML Pull Parser (XPP) allows to pull XML events from input stream. * * Advantages:

      *
    • very simple pull interface * - ideal for deserializing XML objects (like SOAP) *
    • simple and efficient thin wrapper around Tokenizer class * - when compared with using Tokenizer directly adds * about 10% for big documents, * maximum 50% more processing time for small documents *
    • lightweight memory model - minimized memory allocation: * element content and attributes are only read on explicit * method calls, * both StartTag and EndTag can be reused during parsing *
    • small - total compiled size around 20K *
    • by default supports namespaces parsing * (can be switched off) *
    • support for mixed content can be explicitly disabled *
    * * Limitations:
      *
    • this is beta version - may have still bugs :-) *
    • does not parse DTD (recognizes only predefined entities) *
    * * @author Aleksander Slominski */ public class PullParser implements XmlPullParser, XmlPullParserBufferControl, XmlPullParserEventPosition { /** signal logical end of xml document */ //public final static byte END_DOCUMENT = 1; /** start tag was just read */ //public final static byte START_TAG = 2; /** end tag was just read */ //public final static byte END_TAG = 3; /** element content was just read */ //public final static byte CONTENT = 4; /** * Create instance of pull parser. */ public PullParser() { //if(USE_NAMECACHE) { // nameCache = new NameCache(); //} resetState(); } /** * Reset parser and set new input. */ public void setInput(Reader reader) { resetState(); eventEnd = eventStart = 0; tokenizer.setInput(reader); } /** * Reset parser and set new input. */ public void setInput(char[] buf) { resetState(); eventEnd = eventStart = 0; tokenizer.setInput(buf, 0, buf.length); } public void setInput(char[] buf, int off, int len) throws XmlPullParserException { //throw new XmlPullParserException("not implemented"); resetState(); eventEnd = eventStart = off; tokenizer.setInput(buf, off, len); } /** * Reset parser state so it can be used to parse new */ public void reset() { tokenizer.reset(); resetState(); } public boolean isAllowedMixedContent() { return tokenizer.isAllowedMixedContent(); } /** * Allow for mixed element content. * Enabled by default. * When disbaled element must containt either text * or other elements. */ public void setAllowedMixedContent(boolean enable) { tokenizer.setAllowedMixedContent(enable); } public boolean isNamespaceAware() { return supportNs; } /** * Set support of namespaces. Disabled by default. */ public void setNamespaceAware(boolean awareness) throws XmlPullParserException { if(elStackDepth > 0 || seenRootElement) { throw new XmlPullParserException( "namespace support can only be set when not parsing"); } supportNs = awareness; } public boolean isNamespaceAttributesReporting() { return reportNsAttribs; } /** * Make parser to report xmlns* attributes. Disabled by default. * Only meaningful when namespaces are enabled (when namespaces * are disabled all attributes are always reported). */ public void setNamespaceAttributesReporting(boolean enable) { reportNsAttribs = enable; } public String getNamespaceUri() { if(state != START_TAG && state != END_TAG) { throw new PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } ElementContent el = elStack[getDepth() - 1]; return el.uri; } public String getLocalName() { if(state != START_TAG && state != END_TAG) { throw new PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } ElementContent el = elStack[getDepth() - 1]; return el.localName; } public String getPrefix() { if(state != START_TAG && state != END_TAG) { throw new PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } ElementContent el = elStack[getDepth() - 1]; return el.prefix; } public String getRawName() { if(state != START_TAG && state != END_TAG) { throw new PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } ElementContent el = elStack[getDepth() - 1]; return el.qName; } public String getQNameLocal(String qName) { int i = qName.lastIndexOf(':'); return qName.substring(i + 1); } public String getQNameUri(String qName) throws XmlPullParserException { if(elStackDepth == 0) throw new XmlPullParserException( "parsing must be started to get uri from qname"); int i = qName.lastIndexOf(':'); if(i > 0) { String prefix = qName.substring(0, i); return (String) prefix2Ns.get(prefix); } else { return elStack[elStackDepth-1].defaultNs; } } public int getDepth() { return (state != END_TAG) ? elStackDepth : elStackDepth + 1; } public int getNamespacesLength(int depth) { if(depth <= 0) throw new IllegalArgumentException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new IllegalArgumentException( "the depth "+depth+" that was passed for length of namespaces "+ " can not be bigger than current depth of "+maxDepth); } ElementContent el = elStack[ depth - 1 ]; return el.prefixesEnd; } /** * Return namespace prefixes for element at depth */ public void readNamespacesPrefixes(int depth, String[] prefixes, int off, int len) throws XmlPullParserException { if(depth <= 0) throw new XmlPullParserException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new XmlPullParserException( "passed prefixes array of length "+depth+ " can not be bigger than current depth of "+maxDepth); } if(len == 0) { return; } ElementContent el = elStack[ depth - 1 ]; if(el.prefixesEnd == 0) { return; } if(len > el.prefixesEnd) { throw new XmlPullParserException( "number of prefixes to copy "+len +" is bigger than available "+el.prefixesEnd); } System.arraycopy(el.prefixes, 0, prefixes, off, len); } /** * Return namespace URIs for element at depth */ public void readNamespacesUris(int depth, String[] uris, int off, int len) throws XmlPullParserException { if(depth <= 0) throw new XmlPullParserException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new XmlPullParserException( "passed namespace URIs array of length "+depth+ " can not be bigger than current depth of "+maxDepth); } if(len == 0) { return; } ElementContent el = elStack[ depth - 1]; if(el.prefixesEnd == 0) { return; } if(len > el.prefixesEnd) { throw new XmlPullParserException( "number of namespace URIs to copy "+len +" is bigger than available "+el.prefixesEnd); } System.arraycopy(el.namespaceURIs, 0, uris, off, len); } /** * Return string describing current position of parser in input stream. */ public String getPosDesc() { String desc; switch(state) { case START_TAG: desc = "START_TAG"; break; case CONTENT: desc = "CONTENT"; break; case END_TAG: desc = "END_TAG"; break; case END_DOCUMENT: desc = "END_DOCUMENT"; break; default: desc = "UNKNONW_EVENT ("+state+")"; } return tokenizer.getPosDesc()+" (parser state "+desc+")"; } public int getLineNumber() { return tokenizer.getLineNumber(); } public int getColumnNumber() { return tokenizer.getColumnNumber(); } /** * This is key method - it reads more from input stream * and returns next event type * (such as START_TAG, END_TAG, CONTENT). * or END_DOCUMENT if no more input. * *

    This is simple automata (in pseudo-code): *

         * byte next() {
         *    while(state != END_DOCUMENT) {
         *      token = tokenizer.next();  // get next XML token
         *      switch(token) {
         *
         *      case Tokenizer.END_DOCUMENT:
         *        return state = END_DOCUMENT
         *
         *      case Tokenizer.CONTENT:
         *        // check if content allowed - only inside element
         *        return state = CONTENT
         *
         *     case Tokenizer.ETAG_NAME:
         *        // popup element from stack - compare if matched start and end tag
         *        // if namespaces supported restore namespaces prefix mappings
         *        return state = END_TAG;
         *
         *      case Tokenizer.STAG_NAME:
         *        // create new  element push it on stack
         *        // process attributes (including namespaces)
         *        // set emptyElement = true; if empty element
         *        // check atribute uniqueness (including nmespacese prefixes)
         *        return state = START_TAG;
         *
         *      }
         *    }
         * }
         * 
    * *

    Actual parsing is more complex especilly for start tag due to * dealing with attributes reported separately from tokenizer and * declaring namespace prefixes and uris. * * * */ public byte next() throws XmlPullParserException, IOException { // update event start to current tokenizer position eventEnd = eventStart = tokenizer.pos; // MOTIVATION: save some memory by not reporting "" content // if(emptyElementContent) { // emptyElementContent = false; // elContent = ""; // return state = CONTENT; // } if(emptyElement) { --elStackDepth; //TODO if(elStackDepth == 0) seenRootElement = true; emptyElement = false; return state = END_TAG; } Attribute ap = null; ElementContent el = null; //try { do { String s; token = tokenizer.next(); //System.err.println("got token="+token); switch(token) { case Tokenizer.END_DOCUMENT: // update event start to current tokenizer position state = END_DOCUMENT; if(elStackDepth > 0) { throw new XmlPullParserException( "expected element end tag '" +elStack[elStackDepth-1].qName+"' not end of document" +getPosDesc(), getLineNumber(), getColumnNumber()); } // SAX endDocument eventEnd = tokenizer.pos; return state; case Tokenizer.CONTENT: state = CONTENT; if(elStackDepth > 0) { elContent = null; //SAX characters(...) eventEnd = tokenizer.posEnd; return state; } else if(tokenizer.seenContent) { throw new XmlPullParserException( "only whitespace content allowed outside root element" +getPosDesc(), getLineNumber(), getColumnNumber()); } // else ignored --> allow whitespace content outside of root element eventEnd = eventStart = tokenizer.pos; break; case Tokenizer.ETAG_NAME: // include leading = 0; --i) { //SAX2 endPrefixMapping(el.prefixes[i]); //System.err.println("el="+el); if( el.prefixPrevNs[i] != null) { prefix2Ns.put( el.prefixes[i], el.prefixPrevNs[i] ); } else { prefix2Ns.remove( el.prefixes[i] ); } } //el.prefixesEnd = 0; it will make impossible to retrieve readNamespaces... //if(elStackDepth > 0 && !el.defaultNs.equals(elStack[elStackDepth-1].defaultNs) //SAX2 endPrefixMapping("", el.defaultNs) ??? } //SAX2 endElement(el.uri, el.localName, el.qName) eventEnd = tokenizer.pos; return state; case Tokenizer.STAG_NAME: // include leading < in tag eventStart = tokenizer.posStart - 1; state = START_TAG; if(seenRootElement) throw new XmlPullParserException( "no markup allowed outside root element"+getPosDesc(), getLineNumber(), getColumnNumber()); //beforeAtts = true; //emptyElementContent = emptyElement = false; if(elStackDepth >= elStackSize) { ensureCapacity(elStackDepth + 1); } el = elStack[elStackDepth]; el.prefixesEnd = 0; attrPosEnd = 0; el.defaultNs = null; //if(USE_NAMECACHE) { // el.qName = nameCache.lookup( // tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); //} else { // if(!USE_CSC) { el.qName = new String( tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); // } else { // el.qName = stringConverter.convert( // tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); // } //} // if(USE_QNAMEBUF) { // int len = tokenizer.posEnd - tokenizer.posStart; // if(el.qNameBuf == null || len > el.qNameBuf.length) { // el.qNameBuf = new char[len < 8 ? 8 : len + 8]; // } // //System.arraycopy (tokenizer.buf, tokenizer.posStart, el.qNameBuf, 0, len); // for(int i = 0; i < len; ++i) { // el.qNameBuf[i] = tokenizer.buf[ i + tokenizer.posStart ]; // } // } if(supportNs && tokenizer.posNsColon >= 0) { if(tokenizer.nsColonCount > 1) throw new XmlPullParserException( "only one colon allowed in prefixed element name" +getPosDesc(), getLineNumber(), getColumnNumber()); el.prefix = el.qName.substring(0, tokenizer.posNsColon - tokenizer.posStart); el.localName = el.qName.substring(tokenizer.posNsColon - tokenizer.posStart + 1); } else { el.prefix = null; el.localName = el.qName; } el.uri = null; ++elStackDepth; break; case Tokenizer.ATTR_NAME: if(attrPosEnd >= attrPosSize) ensureAttribs(attrPosEnd + 1); ap = attrPos[attrPosEnd]; //if(USE_NAMECACHE) { // ap.qName = nameCache.lookup( // tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); //} else { //ap.qName = new String( //tokenizer.buf,tokenizer.posStart,tokenizer.posEnd-tokenizer.posStart); // if(!USE_CSC) { ap.qName = new String( tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); // } else { // ap.qName = stringConverter.convert( // tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); // } //} ap.uri = null; if(supportNs && tokenizer.posNsColon >= 0) { if(tokenizer.nsColonCount > 1) throw new XmlPullParserException( "only one colon allowed in prefixed attribute name" +getPosDesc(), getLineNumber(), getColumnNumber()); //ap.prefix = ap.qName.substring( // 0, tokenizer.posNsColon - tokenizer.posStart); // if(!USE_CSC) { ap.prefix = ap.qName.substring( 0, tokenizer.posNsColon - tokenizer.posStart); // } else { // ap.prefix = stringConverter.convert( // tokenizer.buf, tokenizer.posStart, tokenizer.posNsColon - tokenizer.posStart); // } if(tokenizer.posEnd == tokenizer.posNsColon) { throw new XmlPullParserException( "xmlns: is not allowed to declare default namespace,"+ " use xmlns instead" +getPosDesc(), getLineNumber(), getColumnNumber()); } //ap.localName = // ap.qName.substring(tokenizer.posNsColon - tokenizer.posStart + 1); // if(!USE_CSC) { ap.localName = ap.qName.substring(tokenizer.posNsColon - tokenizer.posStart + 1); // } else { // ap.localName = stringConverter.convert( // tokenizer.buf, tokenizer.posNsColon + 1, // tokenizer.posEnd - tokenizer.posNsColon - 1); // } } else { ap.prefix = null; ap.localName = ap.qName; } break; case Tokenizer.ATTR_CONTENT: if(tokenizer.parsedContent) { //if(USE_NAMECACHE) { // ap.value = nameCache.lookup( // tokenizer.pc, tokenizer.pcStart, tokenizer.pcEnd -tokenizer.pcStart); //} else { ap.value = new String( tokenizer.pc, tokenizer.pcStart, tokenizer.pcEnd -tokenizer.pcStart); //} } else { //if(USE_NAMECACHE) { // ap.value = nameCache.lookup( // tokenizer.buf, tokenizer.posStart, tokenizer.posEnd - tokenizer.posStart); //} else { ap.value = new String( tokenizer.buf,tokenizer.posStart,tokenizer.posEnd-tokenizer.posStart); //} } if(supportNs) { // if((!USE_CSC && "xmlns".equals(ap.prefix)) // || (USE_CSC && "xmlns" == ap.prefix)) { if("xmlns".equals(ap.prefix)) { // add new NS prefix if(el.prefixesEnd >= el.prefixesSize) { el.ensureCapacity(el.prefixesEnd); } if(ap.value.length() == 0) { // http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl throw new XmlPullParserException( "the declared xmlns namespace for '"+ap.localName+"' name " +" may not be empty" +getPosDesc(), getLineNumber(), getColumnNumber()); } el.prefixes[el.prefixesEnd] = ap.localName; el.namespaceURIs[el.prefixesEnd] = ap.value; el.prefixPrevNs[el.prefixesEnd] = (String) prefix2Ns.get(ap.localName); if(CHECK_ATTRIB_UNIQ) { //NOTE: O(n2) complexity but n is very small... //System.err.println("checking xmlns name="+ap.localName); for(int i = 0; i < el.prefixesEnd; ++i) { // if((!USE_CSC && ap.localName.equals(el.prefixes[i])) // || (USE_CSC && ap.localName == el.prefixes[i])) { if(ap.localName.equals(el.prefixes[i])) { throw new XmlPullParserException( "duplicate xmlns declaration name '"+ap.localName+"'" +getPosDesc(), getLineNumber(), getColumnNumber()); } } } ++el.prefixesEnd; //System.err.println("adding prefix="+att.localName+" ns="+att.value); prefix2Ns.put(ap.localName, ap.value); //SAX2 startPrefixMapping(ap.localName, ap.value) if(reportNsAttribs) { ap.xmlnsAttrib = true; ++attrPosEnd; } // } else if((!USE_CSC && "xmlns".equals(ap.qName)) // || (USE_CSC && "xmlns" == ap.qName)) { } else if("xmlns".equals(ap.qName)) { if(el.defaultNs != null) throw new XmlPullParserException( "default namespace was alredy declared by xmlns attribute" +getPosDesc(), getLineNumber(), getColumnNumber()); //System.err.println("adding default ns="+att.value); el.defaultNs = ap.value; if(reportNsAttribs) { ap.xmlnsAttrib = true; ++attrPosEnd; } } else { //SAX2 if namespace-prefixes always add ap.xmlnsAttrib = false; ++attrPosEnd; // new attribute is added to list } } else { // ! supportNs if(CHECK_ATTRIB_UNIQ) { //NOTE: O(n2) complexity but n is small... for(int i = 0; i < attrPosEnd; ++i) { // if((!USE_CSC && ap.qName.equals(attrPos[i].qName)) // ||(USE_CSC && ap.qName == attrPos[i].qName)) { if(ap.qName.equals(attrPos[i].qName)) { throw new XmlPullParserException( "duplicate attribute name '"+ap.qName+"'" +getPosDesc(), getLineNumber(), getColumnNumber()); } } } ap.xmlnsAttrib = false; ++attrPosEnd; // new attribute is added to list } break; case Tokenizer.EMPTY_ELEMENT: //emptyElementContent = emptyElement = true; break; case Tokenizer.STAG_END: if(supportNs) { if(el.defaultNs == null) { if(elStackDepth > 1) { el.defaultNs = elStack[elStackDepth-2].defaultNs; } else { el.defaultNs = ""; } } // else //SAX2 startPrefixMapping("", el.defaultNs) ??? // if(el.uri == null) { // el.uri = el.defaultNs; // } //System.err.println("el default ns="+el.defaultNs); if(el.prefix != null) { el.uri = (String) prefix2Ns.get(el.prefix); if(el.uri == null) throw new XmlPullParserException( "no namespace for prefix '"+el.prefix+"'" +getPosDesc(), getLineNumber(), getColumnNumber()); // assert(stag.uri != null); } else { //stag.uri = ""; el.uri = el.defaultNs; //System.err.println("setting el default uri="+stag.uri); el.localName = el.qName; } for(int j = 0; j < attrPosEnd ; ++j) { ap = attrPos[j]; if(! ap.xmlnsAttrib && ap.uri == null && ap.prefix != null) { ap.uri = (String) prefix2Ns.get(ap.prefix); if(ap.uri == null) throw new XmlPullParserException( "no namespace for prefix "+ap.prefix+getPosDesc(), getLineNumber(), getColumnNumber()); } } if(CHECK_ATTRIB_UNIQ) { //when namesapces: only now can check attribute uniquenes //NOTE: O(n2) complexity but n is small... for(int j = 1; j < attrPosEnd ; ++j) { ap = attrPos[j]; for(int i = 0; i < j; ++i) { if(! ap.xmlnsAttrib && ! attrPos[i].xmlnsAttrib // && ((!USE_CSC && ap.localName.equals(attrPos[i].localName)) // || (USE_CSC && ap.localName == attrPos[i].localName)) && (ap.localName.equals(attrPos[i].localName)) && ( (ap.uri != null && ap.uri.equals(attrPos[i].uri)) || (ap.uri == null && attrPos[i].uri == null)) ) { throw new XmlPullParserException( "duplicate attribute name '"+ap.qName+"'" +((ap.uri != null) ? " (with namespace '"+ap.uri+"')" : "") +" and " +((ap.uri != null) ? " (with namespace '"+ap.uri+"')" : "") +getPosDesc(), getLineNumber(), getColumnNumber()); } } } } } else { // no namespaces el.prefix = null; el.localName = el.qName; el.uri = ""; } //SAX2 startElement(el.uri, el.localName, el.qName, el) eventEnd = tokenizer.pos; return state; case Tokenizer.DOCTYPE: throw new XmlPullParserException( " 3)) { elContent = new String( tokenizer.buf, tokenizer.posStart, len); // } else { // elContent = stringConverter.convert( // tokenizer.buf, tokenizer.posStart, len); // } // } } } return elContent; } /** * Read value of just read END_TAG into passed as argument EndTag. */ public void readEndTag(XmlEndTag etag) throws XmlPullParserException { if(state != END_TAG) throw new XmlPullParserException( "no end tag available to read"+getPosDesc(), getLineNumber(), getColumnNumber()); //etag.qName = elStack[elStackDepth].qName; //etag.uri = elStack[elStackDepth].uri; //etag.localName = elStack[elStackDepth].localName; ElementContent el = elStack[elStackDepth]; etag.resetEndTag(); etag.modifyTag(el.uri, el.localName, el.qName); } /** * Read value of just read START_TAG into passed as argument StartTag. */ public void readStartTag(XmlStartTag stag) throws XmlPullParserException { if(state != START_TAG) throw new XmlPullParserException( "no start tag available to read"+getPosDesc(), getLineNumber(), getColumnNumber()); //if(beforeAtts == false) // throw new XmlPullParserException( // "start tag was already read"+getPosDesc(), getLineNumber(), getColumnNumber()); stag.resetStartTag(); ElementContent el = elStack[elStackDepth - 1]; //stag.qName = el.qName; //stag.uri = el.uri; //stag.localName = el.localName; stag.modifyTag(el.uri, el.localName, el.qName); // process atttributes stag.ensureAttributesCapacity(attrPosEnd); //stag.attEnd = attrPosEnd; for(int i = 0; i < attrPosEnd; ++i) { Attribute ap = attrPos[i]; // place for next attribute value //Attribute att = stag.attArr[i]; //att.qName = ap.qName; //att.localName = ap.localName; //att.value = ap.value; //att.uri = ap.uri; stag.addAttribute( ap.uri, ap.localName, ap.qName, ap.value, ap.xmlnsAttrib); } } public void readNodeWithoutChildren(XmlNode node) throws XmlPullParserException { readStartTag(node); if(supportNs) { ElementContent el = elStack[elStackDepth-1]; node.setDefaultNamespaceUri(el.defaultNs); //System.err.println("adding my namespace size="+el.prefixesEnd); // for(int i = 0; i < el.prefixesEnd; i++) { // System.err.println("adding"+ // " el.prefixes["+i+"] = "+el.prefixes[i]+ // " el.namespaceURIs["+i+"] = "+el.namespaceURIs[i]); // } node.addDeclaredNamespaces( el.prefixes, 0, el.prefixesEnd, el.namespaceURIs); } // (state != END_TAG) ? elStackDepth : elStackDepth + 1; } public byte readNode(XmlNode node) throws XmlPullParserException, IOException { readNodeWithoutChildren(node); ElementContent el = elStack[elStackDepth-1]; int level = elStackDepth; //byte type = PullParser.END_TAG; //Stack stack = new Stack(); //stack.push(node); while(true) { byte state = next(); switch(state) { case XmlPullParser.START_TAG: XmlNode child = node.newNode(); readNodeWithoutChildren(child); //System.err.println("read "+child); // readStartTag(child); // if(supportNs) { // child.setDefaultNamespaceUri(el.defaultNs); // //System.err.println("adding namespace size="+el.prefixesEnd); // child.addDeclaredNamespaces( // el.prefixes, 0, el.prefixesEnd, el.namespaceURIs); // } node.appendChild(child); el = elStack[elStackDepth-1]; el.node = node; node = child; break; case XmlPullParser.CONTENT: // skip element content when it is empty string "" ... //if(eventEnd > eventStart) { node.appendChild(readContent()); //} break; case XmlPullParser.END_TAG: if(elStackDepth >= level) { node = elStack[elStackDepth].node; } else { return state; } break; } } } /** * If parser has just read start tag it allows to skip whoole * subtree contined in this element. Returns when encounters * end tag matching the start tag. */ public byte skipNode() throws XmlPullParserException, IOException { if(state != START_TAG) { throw new XmlPullParserException( "start tag must be read before skiping subtree"+getPosDesc(), getLineNumber(), getColumnNumber()); } int level = 1; byte type = XmlPullParser.END_TAG; while(level > 0) { type = next(); switch(type) { case XmlPullParser.START_TAG: ++level; break; case XmlPullParser.END_TAG: --level; break; } } return type; } // low level API: interface to parser internal data - good for perf public int getHardLimit() { return tokenizer.getHardLimit(); } public void setHardLimit(int value) throws XmlPullParserException { //try { tokenizer.setHardLimit(value); //} catch(TokenizerException ex) { // throw new XmlPullParserException("could not set hard limit to "+value, ex); //} } public int getSoftLimit() { return tokenizer.getSoftLimit(); } public void setSoftLimit(int value) throws XmlPullParserException { //try { tokenizer.setSoftLimit(value); //} catch(TokenizerException ex) { // throw new XmlPullParserException("could not set soft limit to "+value, ex); //} } public int getBufferShrinkOffset() { return tokenizer.getBufferShrinkOffset(); } public void setBufferShrinkable(boolean shrinkable) throws XmlPullParserException { tokenizer.setBufferShrinkable(shrinkable); } public boolean isBufferShrinkable() { return tokenizer.isBufferShrinkable(); } public int getEventStart() { return eventStart; } // eventStart = tokenizer.pos, parsing..., eventEnd = tokenizer.pos } public int getEventEnd() { return eventEnd; } // equivalent to tokenizer.buf ALWAYS (never tokenizer.pc) public char[] getEventBuffer() { return tokenizer.buf; } // ====== utility methods /** * Make sure that we have enough space to keep element stack if passed size. */ protected void ensureCapacity(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 //if(elStackSize < newSize) { if(elStackSize < size) { if(TRACE_SIZING) { System.err.println("elStack "+elStackSize+" ==> "+newSize); } ElementContent[] newStack = new ElementContent[newSize]; if(elStack != null) { System.arraycopy(elStack, 0, newStack, 0, elStackSize); } for(int i = elStackSize; i < newSize; ++i) { newStack[i] = new ElementContent(); } elStack = newStack; elStackSize = newSize; } } /** * Make sure that in attributes temporary array is enough space. */ protected void ensureAttribs(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 //if(attrPosSize < newSize) { if(attrPosSize < size) { if(TRACE_SIZING) { System.err.println("attrPos "+attrPosSize+" ==> "+newSize); } Attribute[] newAttrPos = new Attribute[newSize]; if(attrPos != null) { System.arraycopy(attrPos, 0, newAttrPos, 0, attrPosSize); } for(int i = attrPosSize; i < newSize; ++i) { newAttrPos[i] = new Attribute(); //inner classes are weird :-) } attrPos = newAttrPos; attrPosSize = newSize; } } protected void resetState() { tokenizer.paramNotifyDoctype = true; token = state = -1; eventStart = -1; elStackDepth = 0; prefix2Ns.clear(); // 4. NC: Prefix Declared prefix2Ns.put("xml", "http://www.w3.org/XML/1998/namespace"); //beforeAtts = false; //emptyElementContent = emptyElement = false; seenRootElement = false; //scache = new StringCache(); } // ===== internals private final static boolean TRACE_SIZING = false; protected final static boolean USE_QNAMEBUF = false; //protected final static boolean USE_CSC = false; //protected final static boolean USE_NAMECACHE = true; //NameCache nameCache; /** * Should attribute uniqueness be checked for attributes * as in specified XML and NS specifications? */ protected final static boolean CHECK_ATTRIB_UNIQ = true; //private boolean beforeAtts; /** Have we read empty element? */ protected boolean emptyElement; ///** just to make that empty element content must be emitted */ //protected boolean emptyElementContent; /** Have we seen root element */ protected boolean seenRootElement; /** Content of current element if in CONTENT state */ protected String elContent; /** XML tokenizer that is doing actual tokenizning of input stream. */ protected Tokenizer tokenizer = new Tokenizer(); /** start position of current event in tokenizer biffer */ protected int eventStart; /** end position of current event in tokenizer biffer */ protected int eventEnd; /** what is current event type as returned from next()? */ protected byte state; /** what is current token returned from tokeizer */ protected byte token; //private StringCache scache = new StringCache(); //FIXME // mapping namespace prefixes to uri /** should parser support namespaces? */ protected boolean supportNs; /** should parser report namespace xmlns* attributes ? */ protected boolean reportNsAttribs; /** mapping of names prefixes to uris */ protected Hashtable prefix2Ns = new Hashtable(); /* private String stagValue; private String stagPC; private int stagEnd; private int stagPCStart; private int stagPCEnd; private int stagValueStart; private int stagValueEnd; private int stagPosNsColon; //private int stagNsColonCount; */ /** index for last attribute in attrPos array */ protected int attrPosEnd; /** size of attrPos array */ protected int attrPosSize; /** temporary array of current attributes */ protected Attribute attrPos[]; // for validating element pairing and string namespace context /** how many elements are on elStack */ protected int elStackDepth; /** size of elStack array */ protected int elStackSize; /** temprary array to keep ElementContent stack */ protected ElementContent[] elStack; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/tokenizer/0000755000175000017500000000000010232453172026027 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/tokenizer/Tokenizer.java0000644000175000017500000021743407755336257030703 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Tokenizer.java,v 1.14 2003/09/07 05:11:36 aslom Exp $ */ package org.gjt.xpp.impl.tokenizer; import java.io.*; import org.gjt.xpp.impl.tag.PullParserRuntimeException; /** * Simpe XML Tokenizer (SXT) performs input stream tokenizing. * * Advantages:

      *
    • utility class to simplify creation of XML parsers, especially * suited for pull event model but can support also push (SAX2) *
    • small footprint: whole tokenizer is in one file *
    • minimal memory utilization: does not use memory except for input * and content buffer (that can grow in size) *
    • fast: all parsing done in one function (simple automata) *
    • supports most of XML 1.0 (except validation and external entities) *
    • low level: supports on demand parsing of Characters, * CDSect, Comments, PIs etc.) *
    • parsed content: supports providing on demand * parsed content to application (standard entities expanded * all CDATA sections inserted, Comments and PIs removed) * not for attribute values and element content *
    • mixed content: allow to dynamically disable mixed content *
    • small - total compiled size around 15K *
    * * Limitations:
      *
    • it is just a tokenizer - does not enforce grammar *
    • readName() is using Java identifier rules not XML *
    • does not parse DOCTYPE declaration (skips everyting in [...]) *
    * * @author Aleksander Slominski */ public class Tokenizer { //enumeration of tokens that can be returned public final static byte END_DOCUMENT = 2; public final static byte CONTENT = 10; public final static byte CHARACTERS = 20; public final static byte CDSECT = 30; public final static byte COMMENT = 40; public final static byte DOCTYPE = 50; public final static byte PI = 60; public final static byte ENTITY_REF = 70; public final static byte CHAR_REF = 75; public final static byte ETAG_NAME = 110; public final static byte EMPTY_ELEMENT = 111; public final static byte STAG_END = 112; public final static byte STAG_NAME = 120; public final static byte ATTR_NAME = 122; public final static byte ATTR_CHARACTERS = 124; public final static byte ATTR_CONTENT = 127; // parameters controlling tokenizer behaviour public boolean paramNotifyCharacters; public boolean paramNotifyComment; public boolean paramNotifyCDSect; public boolean paramNotifyDoctype; public boolean paramNotifyPI; public boolean paramNotifyCharRef; public boolean paramNotifyEntityRef; public boolean paramNotifyAttValue; public char[] buf = new char[BUF_SIZE]; /** position of next char that will be read from buffer */ public int pos; /** * Range [posStart, posEnd) defines part of buf that is content * of current token iff parsedContent == false */ public int posStart; public int posEnd; public int posNsColon; public int nsColonCount; public boolean seenContent; /** * This falg decides which buffer will be used to retrieve * content for current token. If true use pc and [pcStart, pcEnd) * and if false use buf and [posStart, posEnd) */ public boolean parsedContent; /** * This is buffer for parsed content such as * actual valuue of entity * ('&lt;' in buf but in pc it is '<') */ public char[] pc = new char[BUF_SIZE]; /** * Range [pcStart, pcEnd) defines part of pc that is content * of current token iff parsedContent == false */ public int pcStart; public int pcEnd; public Tokenizer() { } public void reset() { // release buffer that may have been used by setInput(char[])... if(!reading) { // re-allocate if data was taken from input char[] //|| ((hardLimit != -1) && (buf.length < hardLimit)) //) { //if(hardLimit != -1) { if(softLimit != -1) { resize(softLimit); } else { resize(BUF_SIZE); } } resetState(); } private void resetState() { reading = true; reader = null; bufSize = buf.length; bufStart = bufEnd = 0; posEnd = posStart = pos = 0; posNsColon = -1; state = STATE_INIT; prevCh = '\0'; posCol = posRow = 1; //reachedEnd = false; pcEnd = pcStart = 0; // shrink to default size PC buf -- good for preserving memory! if(pc.length > 2 * BUF_SIZE) { pc = new char[BUF_SIZE]; } previousState = -1; backtracking = false; seenContent = false; shrinkOffset = 0; } /** Reset tokenizer state and set new input source */ public void setInput(Reader r) { reset(); reading = true; reader = r; bufStart = bufEnd = 0; } /** Reset tokenizer state and set new input source */ public void setInput(char[] data) { setInput(data, 0 , data.length); } public void setInput(char[] data, int off, int len) { resetState(); reading = false; buf = data; bufStart = pos = off; bufSize = bufEnd = off + len; //buf.length; //if(paramPC && pc.length < bufSize) { // pc = new char[bufSize]; // if(TRACE_SIZING) for(int i = 0; i < bufSize; ++i) pc[i]='X'; //} } /** * Set notification of all XML content tokens: * Characters, Comment, CDSect, Doctype, PI, EntityRef, CharRef and * AttValue (tokens for STag, ETag and Attribute are always sent). */ public void setNotifyAll(boolean enable) { paramNotifyCharacters = enable; paramNotifyComment = enable; paramNotifyCDSect = enable; paramNotifyDoctype = enable; paramNotifyPI = enable; paramNotifyEntityRef = enable; paramNotifyCharRef = enable; paramNotifyAttValue = enable; } /** * Allow reporting parsed content for element content * and attribute content (no need to deal with low level * tokens such as in setNotifyAll). */ public void setParseContent(boolean enable) { paramPC = enable; //if(paramPC && pc.length < bufSize) { // pc = new char[bufSize]; //} } public boolean isAllowedMixedContent() { return !paramNoMixContent ; } /** * Set support for mixed conetent. If mixed content is * disabled tokenizer will do its best to ensure that * no element has mixed content model also ignorable whitespaces * will not be reported as element content. */ public void setAllowedMixedContent(boolean enable) { paramNoMixContent = !enable; } public int getSoftLimit() { return softLimit; } /** * Set soft limit on internal buffer size. * That means suggested size that tokznzier will try to keep. */ public void setSoftLimit(int value) throws TokenizerException { //if(state != STATE_INIT) { // throw new TokenizerException( // "soft limit can not be changed after parsing started"); //} if(!reading) { throw new TokenizerException( "hard limit can not be set for char array input" ); } if((value != -1) && (hardLimit != -1) && (2 * value > hardLimit)) { throw new TokenizerException( "soft limit can no tbe bigger than half of hard limit" +"current hard limit "+hardLimit ); } softLimit = value; if(softLimit != -1) { posSafe = softLimit; } else if(hardLimit != -1) { posSafe = hardLimit / 2; } else { posSafe = ((loadFactor * bufSize) / 100); //restore default } } public int getHardLimit() { return hardLimit; } /** * Set hard limit on internal buffer size. * That means that if input (such as element content) is bigger than * hard limit size tokenizer will throw * XmlTokenizerBufferOverflowException. */ public void setHardLimit(int value) throws TokenizerException { if(!reading) { throw new TokenizerException( "hard limit can not be set for char array input" ); } if(state != STATE_INIT && value < hardLimit) { throw new TokenizerException( "hard limit on buffer size can not be shrunk during parsing" ); } if(softLimit == -1 && value != -1) { throw new TokenizerException( "soft limit must be set to non -1 before setting hard limit" +getPosDesc(), posRow, (posCol-1) ); } if((value != -1) && ((2 * softLimit) >= value)) { throw new TokenizerException( "hard limit must be at least twice the size of soft limit" +"current soft limit "+softLimit+" and hard limit "+value +getPosDesc(), posRow, (posCol-1) ); } // resize buffer to new hard limit hardLimit = value; if(shrinkable && softLimit != -1 && softLimit < bufSize) { resize(softLimit); } } public int getBufferShrinkOffset() { return shrinkOffset; } public void setBufferShrinkable(boolean shrinkable) throws TokenizerException { this.shrinkable = shrinkable; } public boolean isBufferShrinkable() { return shrinkable; } // private static int findFragment(int bufStart, char[] b, int start, int j) { // if(start <= bufStart) return start; // int i = start; // while(--i > bufStart) { // if((j - i) > 55) break; // char c = b[i]; // if(c == '<' && (start - i) > 10) break; // } // return i; // } // private static int findFragment(int bufStart, char[] b, int start, int end) { //System.err.println("bufStart="+bufStart+" b="+printable(new String(b, start, end - start))+" start="+start+" end="+end); if(start < bufStart) { start = bufStart; if(start > end) start = end; return start; } if(end - start > 55) { start = end - 10; // try to find good location } int i = start + 1; while(--i > bufStart) { if((end - i) > 55) break; char c = b[i]; if(c == '<' && (start - i) > 10) break; } return i; } /** * Return string describing current position of parsers as * text 'at line %d (row) and column %d (colum) [seen %s...]'. */ public String getPosDesc() { String fragment = null; // if(parsedContent) { // //System.err.println("pcStart="+pcStart+" pcEnd="+pcEnd); // //if(pcStart > 0) fragment = "..."; // if(pcStart <= pcEnd) { // int start = findFragment(pc, pcStart, pcEnd); // if(start < pcEnd) { // fragment = new String(pc, start, pcEnd - start); // if(start > bufStart) fragment = "..." + fragment; // } // } // } else { //System.err.println("posStart="+posStart+" posEnd="+posEnd); //if(posStart > 0) fragment = "..."; if(posStart <= posEnd) { int start = findFragment(bufStart, buf, posStart, posEnd); //System.err.println("start="+start); if(start < posEnd) { fragment = new String(buf, start, posEnd - start); if(start > bufStart) fragment = "..." + fragment; } //} } return " at line "+posRow +" and column "+(posCol-1) +(fragment != null ? " seen "+printable(fragment)+"..." : ""); } public int getLineNumber() { return posRow; } public int getColumnNumber() { return posCol-1; } // ============ utility methods /** * Compare char arraychar after cha * - faster than converting to strings */ private static boolean compareCharArr(char[] a, char[] b, int bStart, int bEnd) { if(bEnd - bStart != a.length) { return false; } for(int i = bStart, j = 0; i < bEnd; ++i, ++j) { if(a[j] != b[i]) return false; } return true; } /** Return printable representation for all specaile chars */ private static String printableChar(char ch) { if(ch == '\n') { return "\\n"; } else if(ch == '\r') { return "\\r"; } else if(ch == '\t') { return "\\t"; } if(ch < 32) { return "\\u"+Character.digit(ch, 16)+""; } return ""+ch; } private static String printable(char ch) { return "'"+printableChar(ch)+"'"; } private static String printable(String s) { int iN = s.indexOf('\n'); int iR = s.indexOf('\r'); int iT = s.indexOf('\t'); if((iN != -1) || (iR != -1) || (iT != -1)) { StringBuffer buf = new StringBuffer("\""); for(int i = 0; i < s.length(); ++i) { buf.append(printableChar(s.charAt(i))); } buf.append("\""); s = buf.toString(); } return s; } // nameStart / name lookup tables based on XML 1.1 http://www.w3.org/TR/2001/WD-xml11-20011213/ protected static final int LOOKUP_MAX = 0x400; protected static final char LOOKUP_MAX_CHAR = (char)LOOKUP_MAX; // protected static int lookupNameStartChar[] = new int[ LOOKUP_MAX_CHAR / 32 ]; // protected static int lookupNameChar[] = new int[ LOOKUP_MAX_CHAR / 32 ]; protected static boolean lookupNameStartChar[] = new boolean[ LOOKUP_MAX ]; protected static boolean lookupNameChar[] = new boolean[ LOOKUP_MAX ]; private static final void setName(char ch) //{ lookupNameChar[ (int)ch / 32 ] |= (1 << (ch % 32)); } { lookupNameChar[ ch ] = true; } private static final void setNameStart(char ch) //{ lookupNameStartChar[ (int)ch / 32 ] |= (1 << (ch % 32)); setName(ch); } { lookupNameStartChar[ ch ] = true; setName(ch); } static { setNameStart(':'); for (char ch = 'A'; ch <= 'Z'; ++ch) setNameStart(ch); setNameStart('_'); for (char ch = 'a'; ch <= 'z'; ++ch) setNameStart(ch); for (char ch = '\u00c0'; ch <= '\u02FF'; ++ch) setNameStart(ch); for (char ch = '\u0370'; ch <= '\u037d'; ++ch) setNameStart(ch); for (char ch = '\u037f'; ch < '\u0400'; ++ch) setNameStart(ch); setName('-'); setName('.'); for (char ch = '0'; ch <= '9'; ++ch) setName(ch); setName('\u00b7'); for (char ch = '\u0300'; ch <= '\u036f'; ++ch) setName(ch); } //private final static boolean isNameStartChar(char ch) { protected boolean isNameStartChar(char ch) { return (ch < LOOKUP_MAX_CHAR && lookupNameStartChar[ ch ]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027') || (ch >= '\u202A' && ch <= '\u218F') || (ch >= '\u2800' && ch <= '\uFFEF') ; // if(ch < LOOKUP_MAX_CHAR) return lookupNameStartChar[ ch ]; // else return ch <= '\u2027' // || (ch >= '\u202A' && ch <= '\u218F') // || (ch >= '\u2800' && ch <= '\uFFEF') // ; //return false; // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == ':' // || (ch >= '0' && ch <= '9'); // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ] & (1 << (ch % 32))) != 0; // if(ch <= '\u2027') return true; // //[#x202A-#x218F] // if(ch < '\u202A') return false; // if(ch <= '\u218F') return true; // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] | [#x10000-#x10FFFF] // if(ch < '\u2800') return false; // if(ch <= '\uFFEF') return true; // return false; // else return (supportXml11 && ( (ch < '\u2027') || (ch > '\u2029' && ch < '\u2200') ... } //private final static boolean isNameChar(char ch) { protected boolean isNameChar(char ch) { //return isNameStartChar(ch); // if(ch < LOOKUP_MAX_CHAR) return (lookupNameChar[ (int)ch / 32 ] & (1 << (ch % 32))) != 0; return (ch < LOOKUP_MAX_CHAR && lookupNameChar[ ch ]) || (ch >= LOOKUP_MAX_CHAR && ch <= '\u2027') || (ch >= '\u202A' && ch <= '\u218F') || (ch >= '\u2800' && ch <= '\uFFEF') ; //return false; // return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == ':' // || (ch >= '0' && ch <= '9'); // if(ch < LOOKUP_MAX_CHAR) return (lookupNameStartChar[ (int)ch / 32 ] & (1 << (ch % 32))) != 0; //else return // else if(ch <= '\u2027') return true; // //[#x202A-#x218F] // else if(ch < '\u202A') return false; // else if(ch <= '\u218F') return true; // // added pairts [#x2800-#xD7FF] | [#xE000-#xFDCF] | [#xFDE0-#xFFEF] | [#x10000-#x10FFFF] // else if(ch < '\u2800') return false; // else if(ch <= '\uFFEF') return true; //else return false; } /** * Determine if ch is whitespace ([3] S) */ protected boolean isS(char ch) { return (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'); // || (supportXml11 && (ch == '\u0085' || ch == '\u2028'); } /** * Read name from input or throw exception ([4] NameChar, [5] Name). */ // TODO: make it fully complaint with XML spec private char readName(char ch) throws IOException, TokenizerException { //int type = Character.getType(ch); //TODO: translate [84]-[89] for Java... posNsColon = -1; nsColonCount = 0; //if( !Character.isLowerCase(ch) // && !Character.isUpperCase(ch) // && ch != ':' // && ch != '_') if(!isNameStartChar(ch)) { throw new TokenizerException( "expected name start not "+printable(ch) +getPosDesc(), posRow, (posCol-1)); } do { ch = more(); if(ch == ':') { posNsColon = pos - 1; ++nsColonCount; } } while( isNameChar(ch)); //Character.isLowerCase(ch) // || Character.isUpperCase(ch) // || Character.isDigit(ch) // || ch == '.' || ch == '-' // || ch == '_' || ch == ':'); return ch; } private char skipS(char ch) throws IOException, TokenizerException //XmlTokenizerBufferOverflowException { while(ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') ch = more(); return ch; } private char readS(char ch) throws IOException, TokenizerException { if(!isS(ch)) throw new TokenizerException( "expected white space not "+ch+getPosDesc(), posRow, (posCol-1)); while(ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') ch = more(); return ch; } // ========= input buffer management /** * Get next available character from input. * If it is last character set internal flag reachedEnd. * If there are no more characters throw EOFException. */ private char more() throws IOException, TokenizerException { if(backtracking) { backtracking = false; //return prevCh = ch; ++pos; ++posCol; if(TRACING) System.err.println( "TRACING BACK XmlTokenizer ch="+printable(prevCh)+" state="+state +" posStart="+posStart+" posEnd="+posEnd +" pcStart="+pcStart+" pcEnd="+pcEnd); //prevCh = prevPrevCh; return prevCh; } if(!reading) { //if(pos == bufEnd - 1) // reachedEnd = true; if(pos >= bufEnd) { throw new EOFException("no more data available"); } } else if(hardLimit != -1 && (pos >= hardLimit - 1)) { // no more place to grow... throw new TokenizerBufferOverflowException( "reached hard limit on buffer size" +getPosDesc(), posRow, (posCol-1)); } else if(pos > bufEnd - 1) { if(hardLimit != -1 && bufSize > hardLimit) { throw new TokenizerBufferOverflowException( "buffer size should never exceed hard limit"+getPosDesc(), posRow, (posCol-1)); } int spaceLeft = bufSize - bufEnd; if(spaceLeft <= readChunkSize) { //expand buffer to accomodate read int newSize = 2 * bufSize; if(hardLimit == -1) { if(newSize < softLimit) { newSize = 2 * softLimit; } if(newSize < 4*readChunkSize) { newSize = 12 * readChunkSize; } } else if(newSize > hardLimit) { //hardLimit != -1 if(bufEnd >= hardLimit) { throw new TokenizerBufferOverflowException( "buffer can not grow beyond hard limit" +getPosDesc(), posRow, (posCol-1)); } if(TRACE_SIZING) { System.err.println("limiting new size to hard limit"); } newSize = hardLimit; } if(newSize - bufSize > 0) { resize(newSize); } } int chunkie = readChunkSize; // sorry that is only how much we are allowed to read - hard limit.. if(bufSize - bufEnd < chunkie) { chunkie = bufSize - bufEnd; } if(reader == null) { throw new TokenizerException( "to start parsing setInput() must be called!"); } int bufRead = reader.read(buf, bufEnd, chunkie); if(bufRead == -1) { //if(reachedEnd) { // throw new TokenizerException( // "can't read more - reached end of stream (state="+state+")" // +getPosDesc()); //} //reachedEnd = true; throw new EOFException("no more data available to read"); } if(bufRead == 0) { // TODO: chekc how it will behave when reading rough socket... throw new TokenizerBufferOverflowException( "can't read more data in buffer (read() returns 0 chars)" +getPosDesc()); } else { bufEnd += bufRead; } //} else { //reading && hardLimit != -1 } char ch = buf[pos++]; // update (row,colum) position so far // new lines: "\r\n","\r\n"... "\n","\n",... "\r","\r","\r" if(ch == '\n' || ch == '\r') { if ( prevCh != '\r' || ch != '\n' ) { posCol = 2; // always one char ahead ++posRow; } // 2.11 End-of-Line Handling //XXX //if(NORMALIZE_LINE_BREAKS && ch == '\r') { //ch = '\n'; // make sure that parsed content will have it correct //if(paramPC && pcStart == pcEnd && posEnd > posStart) { //int len = posEnd - posStart; //System.arraycopy(buf, posStart, pc, pcEnd, len); //pcEnd += len; //} //if(paramPC) //pc[pcEnd++] = '\n'; //} //System.err.println("ch = "+printable(ch)+" posRow="+posRow); } else { ++posCol; } prevPrevCh = prevCh; if(TRACING) System.err.println( "TRACING XmlTokenizer ch="+printable(ch)+" state="+state +" posStart="+posStart+" posEnd="+posEnd +" pcStart="+pcStart+" pcEnd="+pcEnd + " prevCh="+printable(prevCh)); return prevCh = ch; } private void resize(int newSize) { if(TRACE_SIZING) { System.err.println("resizing "+bufSize+" ==> "+newSize); } char[] newBuf = new char[newSize]; int end = bufEnd; if(end > newSize) { // case of shriniking end = newSize; if(state != STATE_INIT) { // should never happen... throw new PullParserRuntimeException( "internal buffer may not be shrank during parsing" +getPosDesc()); } } System.arraycopy(buf, 0, newBuf, 0, end); buf = newBuf; bufSize = newSize; if(softLimit == -1) { posSafe = ((loadFactor * bufSize) / 100); } if(TRACE_SIZING) for(int i = bufEnd; i < bufSize; ++i) buf[i]='X'; //if(paramPC && pc.length < bufSize) { // char[] newpc = new char[bufSize]; // System.arraycopy(pc, 0, newpc, 0, pcEnd); // pc = newpc; // if(TRACE_SIZING) for(int i = pcEnd; i < bufSize; ++i) pc[i]='X'; //} } private void ensurePC() { if(paramPC && pcEnd >= pc.length) { int newSize = 2 * pcEnd + 1; char[] newpc = new char[newSize]; System.arraycopy(pc, 0, newpc, 0, pc.length); pc = newpc; if(TRACE_SIZING) for(int i = pcEnd; i < newSize; ++i) pc[i]='X'; } } /** * Special procedure to undo last read character... */ private char less() { //NOTE: trick - we are backtracing one characker.... --pos; --posCol; backtracking = true; //return buf[pos - 1]; return prevPrevCh; } /** * Shrink processing buffer size. */ private void shrink(int posCut) { //System.err.println("shrink called posCut="+posCut); System.arraycopy(buf, posCut, buf, 0, bufEnd - posCut); shrinkOffset += posCut; bufEnd -= posCut; pos -= posCut; posStart -= posCut; posEnd -= posCut; posNsColon -= posCut; } private void joinPC() { if(pcStart == pcEnd) { appendPC(); } } private void appendPC() { if(posEnd > posStart) { int len = posEnd - posStart; int pcLen = pc.length - pcEnd; if(pcLen < len) { int newSize = len; char[] newpc = new char[newSize]; System.arraycopy(pc, 0, newpc, 0, pc.length); pc = newpc; if(TRACE_SIZING) for(int i = pcEnd; i < newSize; ++i) pc[i]='X'; } System.arraycopy(buf, posStart, pc, pcEnd, len); pcEnd += len; } } /** * Return next recognized toke or END_DOCUMENT if no more input. * *

    This is simple automata (in pseudo-code): *

         * byte next() {
         *    while(state != END_DOCUMENT) {
         *      ch = more();  // read character from input
         *      state = func(ch, state); // do transition
         *      if(state is accepting)
         *        return state;  // return token to caller
         *    }
         * }
         * 
    * *

    For speed (and simplicity?) it is using few procedures * such as readName() or isS(). * * * */ public byte next() throws TokenizerException, IOException { if(state == STATE_FINISHED) throw new TokenizerException("attempt to read beyond end of input"); if(state != STATE_FINISH_CONTENT && state != STATE_FINISH) { try { parsedContent = false; LOOP: while(true) { //if(reachedEnd) { //} char ch = more(); //if(reachedEnd) continue LOOP; // 2.11 End-of-Line Handling: "\r\n" -> "\n"; "\rX" -> "\nX" //XXX if(NORMALIZE_LINE_BREAKS) { if(ch == '\r') { joinPC(); //ch = '\n'; } else if(prevPrevCh == '\r' && ch == '\n') { continue LOOP; //ask for more chars --> ch = more(); // it can not be break as we are not yet in switch(..) } } //System.out.println("prevState="+state); switch(state) { case STATE_INIT: // detect BOM and frop it (Unicode Byte Order Mark) if(ch == '\uFFFE') { throw new TokenizerException( "first character in input was UNICODE noncharacter (0xFFFE)"+ "- input requires byte swapping"); } if(ch == '\uFEFF') { // skipping UNICODE Byte Order Mark (so called BOM) state = STATE_CONTENT_INIT; break; } ; // fall through case STATE_CONTENT_INIT: pcEnd = pcStart = 0; //pos - 1; ; // fall through case STATE_CONTENT_CONTINUED: posEnd = posStart = pos - 1; //seenStartTag = false; // make sure to reset flag state = STATE_CONTENT; ; // fall through case STATE_CONTENT: while(true) { if(ch == '<') { state = STATE_SEEN_LT; if(paramNotifyCharacters && posStart != posEnd) return CHARACTERS; } else if(ch == '&') { if(paramPC) { joinPC(); } if(!seenContent) { seenContent = true; if(paramNoMixContent && !mixInElement) throw new TokenizerException( "mixed content disallowed outside element"+getPosDesc(), posRow, (posCol-1)); } state = STATE_SEEN_AMP; previousState = STATE_CONTENT_CONTINUED; posStart = pos - 1; } else { if(!seenContent && !isS(ch)) { seenContent = true; if(paramNoMixContent && !mixInElement) throw new TokenizerException( "mixed content disallowed outside element, " +"character "+printable(ch) +" ("+(int)ch+")"+getPosDesc(), posRow, (posCol-1)); } posEnd = pos; if(paramPC && ((pcStart != pcEnd) || (NORMALIZE_LINE_BREAKS && ch == '\r')) ) { //NOTE: normalization is done at beginning of LOOP //but it only will prepare pc buffer that is only now filled // CONSIDER: worst case when \r is first character!!!! if(NORMALIZE_LINE_BREAKS && ch == '\r') { if(pcEnd >= pc.length) ensurePC(); pc[pcEnd++] = '\n'; } else { if(pcEnd >= pc.length) ensurePC(); pc[pcEnd++] = ch; } } //if(NORMALIZE_LINE_BREAKS && ch == '\r') { // throw new IllegalStateException( // "end-of-line normalization failed"+getPosDesc()); //} } if(state != STATE_CONTENT) break; ch = more(); if(NORMALIZE_LINE_BREAKS) { if(ch == '\r') { joinPC(); //ch = '\n'; } else if(prevPrevCh == '\r' && ch == '\n') { continue LOOP; //ask for more chars --> ch = more(); // it can not be break as we are not yet in switch(..) } } } break; case STATE_SEEN_LT: if(ch == '!') { state = STATE_SEEN_LT_BANG; } else if(ch == '?') { state = STATE_PI; } else { // it must be STag or ETag boolean prevMixSeenContent = seenContent; boolean prevMixInElement = mixInElement; if(ch == '/') { state = STATE_SCAN_ETAG_NAME; mixInElement = false; } else { state = STATE_SCAN_STAG_NAME; if(paramNoMixContent && seenContent) throw new TokenizerException( "mixed content disallowed"+ " inside element and before start tag"+getPosDesc(), posRow, (posCol-1)); mixInElement = true; } if(paramPC) { if( (pcStart != pcEnd || posEnd != posStart || (state == STATE_SCAN_ETAG_NAME && seenStartTag)) && (paramNoMixContent == false || prevMixSeenContent || (paramNoMixContent //&& !prevMixInElement && state == STATE_SCAN_ETAG_NAME && seenStartTag ) ) ) { parsedContent = (pcEnd != pcStart); // || parsedContent // || (posEnd != posStart) // // condition below allows to report "" content for // || (paramNoMixContent && state == STATE_SCAN_ETAG_NAME // && seenStartTag // //&& prevMixInElement && prevMixSeenContent)) { // //&& prevMixInElement // ) // ) // { // System.out.println("returning CONTENT " // +" posStart="+posStart // +" posEnd="+posEnd // +" pcStart="+pcStart // +" pcEnd="+pcEnd // ); // MOTIVATION: save memory by not reporting "" content if(parsedContent || posEnd != posStart) { return CONTENT; } else { break; } } } } // gather parsed content - keep what was before comments etc. if(paramPC && state != STATE_SCAN_STAG_NAME && state != STATE_SCAN_ETAG_NAME) { joinPC(); } posStart = pos; // to make PI start content break; case STATE_SEEN_LT_BANG: if(ch == '-') { ch = more(); if(ch != '-') throw new TokenizerException( "expected - for start of comment |*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: TokenizerBufferOverflowException.java,v 1.4 2003/04/06 00:03:58 aslom Exp $ */ package org.gjt.xpp.impl.tokenizer; /** * This exception is thrown to signal exceeding tokenizer hard limit * on internal input buffer. * * @author Aleksander Slominski */ public class TokenizerBufferOverflowException extends TokenizerException { public TokenizerBufferOverflowException() { } public TokenizerBufferOverflowException(String s) { super(s); } public TokenizerBufferOverflowException(String s, int row, int column) { super(s, row, column); } //public TokenizerBufferOverflowException(String s, Throwable ex) { // super(s, ex); //} } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/pullparser/org/gjt/xpp/impl/tokenizer/TokenizerException.java0000644000175000017500000000713007755336257032550 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: TokenizerException.java,v 1.4 2003/04/06 00:03:58 aslom Exp $ */ package org.gjt.xpp.impl.tokenizer; import org.gjt.xpp.XmlPullParserException; /** * This exception is thrown to signal all XML tokenizing errors. * * @author Aleksander Slominski */ public class TokenizerException extends XmlPullParserException { public TokenizerException() { } public TokenizerException(String s) { super(s); } public TokenizerException(String s, int row, int column) { super(s, row, column); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/small/0000755000175000017500000000000007755336257017635 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/META-INF/0000755000175000017500000000000007755336257020775 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/META-INF/services/0000755000175000017500000000000010232453172022574 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/META-INF/services/org.gjt.xpp.XmlPullParserFactory0000644000175000017500000000005307755336257031022 0ustar wbaerwbaer00000000000000org.gjt.xpp.impl.PullParserFactorySmallImplPullParser2.1.10/src/java/impl/small/org/0000755000175000017500000000000007755336257020424 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/org/gjt/0000755000175000017500000000000007755336257021210 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/org/gjt/xpp/0000755000175000017500000000000007755336257022017 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/org/gjt/xpp/impl/0000755000175000017500000000000010232453172022734 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/small/org/gjt/xpp/impl/PullParserFactorySmallImpl.java0000644000175000017500000001016007755336257031055 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: PullParserFactorySmallImpl.java,v 1.3 2003/04/06 00:03:58 aslom Exp $ */ package org.gjt.xpp.impl; import org.gjt.xpp.*; import org.gjt.xpp.impl.pullparser.PullParser; import org.gjt.xpp.impl.tag.EndTag; import org.gjt.xpp.impl.tag.StartTag; /** * Implementation of Pull Parser Factory. * * @author Aleksande Slominski */ public class PullParserFactorySmallImpl extends XmlPullParserFactory { public XmlPullParser newPullParser() throws XmlPullParserException { XmlPullParser pp = new PullParser(); pp.setNamespaceAware(isNamespaceAware()); return pp; } public XmlEndTag newEndTag() { return new EndTag(); } public XmlNode newNode() throws XmlPullParserException { throw new XmlPullParserException( "XmlNode creation not supported in XPP small profile"); } public XmlStartTag newStartTag() { return new StartTag(); } public XmlRecorder newRecorder() throws XmlPullParserException { throw new XmlPullParserException( "XmlRecorder creation not supported in XPP small profile"); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/tag/0000755000175000017500000000000007755336257017300 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/0000755000175000017500000000000007755336257020067 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/gjt/0000755000175000017500000000000007755336257020653 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/0000755000175000017500000000000007755336257021462 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/0000755000175000017500000000000007755336257022423 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/0000755000175000017500000000000010232453172023152 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/Attribute.java0000644000175000017500000001047207755336257026010 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Attribute.java,v 1.5 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp.impl.tag; /** * used only internally by XPP * * * @author Aleksander Slominski */ public class Attribute { public String uri; public String localName; public String qName; public String value; public String prefix; /** when true indicates that attribute is xmlns* related */ public boolean xmlnsAttrib; public Attribute() { } public String toString() { StringBuffer buf = new StringBuffer(" "); buf.append("'"+qName+"'"); if(uri != null && !uri.equals("")) { buf.append("('"+uri+"','"+localName+"')"); } buf.append("='"); if(xmlnsAttrib) buf.append("[namespace]"); buf.append(value); buf.append("'"); return buf.toString(); } public boolean equals(Object o) { if(o == null) return false; if(! (o instanceof Attribute) ) return false; Attribute attr = (Attribute) o; return (uri == attr.uri || (uri != null && uri.equals(attr.uri))) && (localName == attr.localName || (localName != null && localName.equals(attr.localName)) && (value == attr.value || (value != null && value.equals(attr.value))) ); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/EndTag.java0000644000175000017500000000720407755336257025206 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: EndTag.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp.impl.tag; import org.gjt.xpp.XmlEndTag; /** * Encapsulate XML ETag * * * @author Aleksander Slominski */ public class EndTag extends Tag implements XmlEndTag { public EndTag() { } public void resetEndTag() { resetTag(); } /** * Return string representation of end tag including name */ public String toString() { StringBuffer buf = new StringBuffer("EndTag={"); printFields(buf); buf.append(" }"); return buf.toString(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/PullParserRuntimeException.java0000644000175000017500000001053207755336257031356 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: PullParserRuntimeException.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp.impl.tag; /** * Extended runtime excpetion to allow chaining. * * @author Aleksander Slominski */ public class PullParserRuntimeException extends RuntimeException { protected Throwable detail; public PullParserRuntimeException(String s) { super(s); } public PullParserRuntimeException(String s, Throwable thrwble) { super(s); this.detail = thrwble; } public PullParserRuntimeException(Throwable thrwble) { this("Pull Parser runtime exception", thrwble); } public Throwable getDetail() { return detail; } public void setDetail(Throwable cause) { this.detail = cause; } public String getMessage() { if(detail == null) return super.getMessage(); else return super.getMessage() + "; nested exception is: \n\t" + detail.getMessage()+" "; } public void printStackTrace() { //System.err.println("YYYYYYY"); if (detail == null) { super.printStackTrace(); } else { synchronized(System.err) { System.err.println(super.getMessage() + "; nested exception is: YY"); detail.printStackTrace(); } } //System.err.println("YYYYYYY2"); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/StartTag.java0000644000175000017500000003070207755336257025574 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: StartTag.java,v 1.13 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp.impl.tag; import java.util.Hashtable; import org.gjt.xpp.XmlStartTag; import org.gjt.xpp.impl.tag.Attribute; /** * Encapsulate XML STag and EmptyElement * * * @author Aleksander Slominski */ public class StartTag extends Tag implements XmlStartTag { // experimental flag to allow check to approaches to handling attribs //private final static boolean MAPPING = false; private final static boolean TRACE_SIZING = false; private int attEnd; private int attSize; private Attribute[] attArr; //private Hashtable mapQName; //private Hashtable mapUri; public StartTag() { // if(MAPPING) { // mapQName = new Hashtable(); // mapUri = new Hashtable(); // } } /** * Reinitialize start tag content to none */ public void resetStartTag() { super.resetTag(); //Reset intenrla valriables but do not clear previous values // (it is more efficient) attEnd = 0; // if(MAPPING) { // mapQName.clear(); // mapUri.clear(); // } } /** * Return number of attributes. */ public int getAttributeCount() { return attEnd; } /** * Get uri of attribute number index (starts from 0). * (meaningful only if namespaces enabled) */ public String getAttributeNamespaceUri(int index) { if (index >= 0 && index < attEnd) { return attArr[index].uri; } else { return null; } } /** * Get localName of attribute number index (starts from 0) * if namespaces enabled or just attribute name if namespaces disabled. */ public String getAttributeLocalName(int index) { if (index >= 0 && index < attEnd) { return attArr[index].localName; } else { return null; } } public String getAttributePrefix(int index) { if (index >= 0 && index < attEnd) { String s = attArr[index].qName; if(s != null) { int pos = s.indexOf(':'); if(pos != -1) { return s.substring(0, pos); } } } return null; } /** Return qName of atrribute number index (starts from 0) */ public String getAttributeRawName(int index) { if (index >= 0 && index < attEnd) { return attArr[index].qName; } else { return null; } } // /** always return "CDATA" */ // public String getAttributeType(int index) { // return "CDATA"; // } /** Return value of attribute number index. */ public String getAttributeValue(int index) { if (index >= 0 && index < attEnd) { return attArr[index].value; } else { return null; } } public boolean isAttributeNamespaceDeclaration(int index) { return attArr[index].xmlnsAttrib; } // /** always return "CDATA" */ // public String getAttributeType(String qName) { // return "CDATA"; // } // // /** always return "CDATA" */ // public String getAttributeType(String uri, String localName) { // return "CDATA"; // } /** * Return value of attribute named (uri, localName) or null * of no such attribute found. * (meaningful only if namespaces enabled) */ public String getAttributeValueFromName(String uri, String localName) { // if(MAPPING) { // Hashtable mapLocal = (Hashtable) mapUri.get(uri); // return (String) mapLocal.get(localName); // } else { for(int i = 0; i < attEnd; ++i) { if((uri != null && uri.equals(attArr[i].uri) || (uri == null && attArr[i].uri == null)) && localName.equals(attArr[i].localName)) { return attArr[i].value; } } return null; // } } /** * Return value of attribute named qName or null * of no such attribute found. */ public String getAttributeValueFromRawName(String qName) { // if(MAPPING) { // return (String) mapQName.get(qName); // } else { for(int i = 0; i < attEnd; ++i) { if(qName.equals(attArr[i].qName)) { return attArr[i].value; } } return null; // } } /** parameters modeled after SAX2 attribute approach */ public void addAttribute(String namespaceUri, String localName, String rawName, String value) { addAttribute(namespaceUri, localName, rawName, value, false); } public void addAttribute(String namespaceUri, String localName, String rawName, String value, boolean isNamespaceDeclaration) { if(attEnd >= attSize) ensureAttributesCapacity(2 * attEnd + 1); // assert namespaceUri != null && localName != null && rawName != null Attribute att = attArr[attEnd++]; att.uri = namespaceUri; att.localName = localName; att.qName = rawName; att.value = value; // if(MAPPING) { // mapQName.put(att.qName, att.value); // Hashtable mapLocal = (Hashtable) mapUri.get(att.uri); // if(mapLocal == null) { // mapLocal = new Hashtable(); // mapUri.put(att.uri, mapLocal); // } // mapLocal.put(att.localName, att.value); // } } /** * Make sure that there is enough space to keep size attributes. */ public void ensureAttributesCapacity(int minCapacity) { int newSize = minCapacity; // if(newSize < 8) // newSize = 8; // = lucky 7 + 1 //25 if(attSize < newSize) { if(TRACE_SIZING) { System.err.println("stag attributes "+attEnd+" ==> "+newSize); } Attribute[] newAttArr = new Attribute[newSize]; if(attArr != null) System.arraycopy(attArr, 0, newAttArr, 0, attEnd); for(int i = attEnd; i < newSize; ++i) { newAttArr[i] = new Attribute(); } attArr = newAttArr; attSize = newSize; } } public boolean removeAttributeByRawName(String rawName) { for(int i = 0; i < attEnd; ++i) { if(rawName.equals(attArr[i].qName)) { removeAttributeAtPos(i); return true; } } return false; } public boolean removeAttributeByName(String uri, String localName) { for(int i = 0; i < attEnd; ++i) { if((uri != null && uri.equals(attArr[i].uri) || (uri == null && attArr[i].uri == null)) && localName.equals(attArr[i].localName)) { // int count = attEnd - i - 1; // if(count > 0) { // Attribute attr = attArr[i]; // // delete by moving over attributes // System.arraycopy(attArr, i + 1, attArr, i, count); // attArr[attEnd - 1] = attr; // } // --attEnd; removeAttributeAtPos(i); return true; } } return false; } private void removeAttributeAtPos(int i) { int count = attEnd - i - 1; if(count > 0) { Attribute attr = attArr[i]; // delete by moving over attributes System.arraycopy(attArr, i + 1, attArr, i, count); // and copying removed attrinute to the end for later reuse attArr[attEnd - 1] = attr; } --attEnd; } /** remove all atribute */ public void removeAttributes() { attEnd = 0; } protected void printFields(StringBuffer buf) { super.printFields(buf); if(attEnd > 0) { buf.append(" attArr=[ "); for(int i = 0; i < attEnd; ++i) { buf.append(attArr[i]+" "); } buf.append(" ]"); } } /** * Return string representation of start tag including name * and list of attributes. */ public String toString() { StringBuffer buf = new StringBuffer("StartTag={"); printFields(buf); buf.append(" }"); return buf.toString(); } public boolean equals(Object o) { if(o == null) return false; if(! (o instanceof StartTag) ) return false; StartTag t = (StartTag) o; if(attEnd != t.attEnd) return false; for (int i = 0; i < attEnd; i++) { if(! attArr[i].equals(t.attArr[i])) { return false; } } return super.equals(o); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/tag/org/gjt/xpp/impl/tag/Tag.java0000644000175000017500000001365707755336257024570 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: Tag.java,v 1.5 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp.impl.tag; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.XmlTag; /** * Encapsulate XML ETag * * * @author Aleksander Slominski */ public class Tag implements XmlTag { private String uri = ""; private String localName; private String qName; // only package level access -- all others use factory protected Tag() { } public void resetTag() { uri = ""; localName = qName = null; } /** Get endtag tag uri (meaningful only if namespaces enabled) */ public String getNamespaceUri() { return uri; } //public void setNamespaceURI(String value) { uri = value; } /** * Get start tag localName if namespaces enabled * or just qName (see below) if namespaces diabled. */ public String getLocalName() { return localName; } //public void setLocalName(String value) { localName = value; } public String getPrefix() { if(qName != null) { int pos = qName.indexOf(':'); if(pos != -1) { return qName.substring(0, pos); } } return null; } /** * Return end tag name as it is in document (qName). */ public String getRawName() { return qName; } //public void setRawName(String value) { qName = value; }; /** this constructor is modeled after SAX2 startTag */ public void modifyTag(String namespaceURI, String localName, String rawName) throws XmlPullParserException { if(rawName == null) { throw new XmlPullParserException( "tag raw name must be not null"); } this.uri = namespaceURI != null ? namespaceURI : ""; this.localName = localName != null ? localName : rawName ; this.qName = rawName; } /** * Print into StringBuffer element name */ protected void printFields(StringBuffer buf) { //if(uri != null) // buf.append(" uri='" + uri + "'"); //if(localName != null) // buf.append(" localName='" + localName + "'"); buf.append(" '" + qName + "'"); if(uri != null && !"".equals(uri)) buf.append("('" + uri +"','" + localName + "') "); } public int hashCode() { int c = (localName != null) ? c = localName.hashCode() : 0; if(uri != null) c = c ^ uri.hashCode(); return c; } public boolean equals(Object o) { if(o == null) return false; if(! (o instanceof Tag) ) return false; Tag t = (Tag) o; return (uri == t.uri || (uri != null && uri.equals(t.uri))) && (localName == t.localName || (localName != null && localName.equals(t.localName))); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/impl/README.txt0000644000175000017500000000066307755336265020227 0ustar wbaerwbaer00000000000000This is default XPP2 implementation. factory - creation of classes implementing XPP2 API format - XML output node - creation of regular and pull XML trees pullparser - implementation of pull parsing (tokenizer + parser) small - special verion of factory that only uses pullparser and tag (especially well suited for small footprint such as J2ME env) tag - repsenting end/start tag and some other base classes (used in impl) PullParser2.1.10/src/java/intf/0000755000175000017500000000000010232453172016500 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/intf/org/0000755000175000017500000000000007755336256017312 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/intf/org/gjt/0000755000175000017500000000000007755336256020076 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/intf/org/gjt/xpp/0000755000175000017500000000000010232453172020662 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/intf/org/gjt/xpp/package.html0000644000175000017500000001161407755336265023171 0ustar wbaerwbaer00000000000000 This package defines classes compromising public API of XML Pull Parser 2.0 (org.gjt.xpp).

    Note this package is deprecated by next version of XML Pull Parser called XPP3/MXP1 that implements XmlPull API.

    Usage:

    Xml Pull Parser (XPP) provides a simple and fast implementation of "pull parsing model" that allows processing application to request parsing events incrementally (ideal for deserializing XML such as SOAP encoding).

    Following steps are required to use XPP:

    1. create an instance of {@link org.gjt.xpp.XmlPullParserFactory} using newInstance() method
    2. create an instance of {@link org.gjt.xpp.XmlPullParser} using newPullParser() method on instance of {@link org.gjt.xpp.XmlPullParserFactory}
    3. set options (if they are different than defaults)
    4. set input by calling either {@link org.gjt.xpp.XmlPullParser#setInput(Reader)} or {@link org.gjt.xpp.XmlPullParser#setInput(char[])}
    5. start parsing by calling {@link org.gjt.xpp.XmlPullParser#next} - this method returns event type and parsing is finished when it returns {@link org.gjt.xpp.XmlPullParser#END_DOCUMENT} event type.

    Typically parsing is done in while loop that will work until {@link org.gjt.xpp.XmlPullParser#next} returns {@link org.gjt.xpp.XmlPullParser#END_DOCUMENT} event. All possible types of events that {@link org.gjt.xpp.XmlPullParser#next} can return:

    • {@link org.gjt.xpp.XmlPullParser#END_DOCUMENT} to signal that parsing is finished
    • {@link org.gjt.xpp.XmlPullParser#START_TAG} - user can now call {@link org.gjt.xpp.XmlPullParser#readStartTag} to get start tag information including element name, (if namespaces are supported, uri and localName can also be obtained) and attributes
    • {@link org.gjt.xpp.XmlPullParser#END_TAG} - end tag was read and user can call {@link org.gjt.xpp.XmlPullParser#readEndTag} to get end tag information
    • {@link org.gjt.xpp.XmlPullParser#CONTENT} element constent was read and user can call {@link org.gjt.xpp.XmlPullParser#readContent} to get it

    If there is parsing error {@link org.gjt.xpp.XmlPullParser#next} will throw {@link org.gjt.xpp.XmlPullParserException}.

    An example Java program may look like this: (for more detailed example please see src/java/samples/)

      // 1. creating instance of parser
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      XmlPullParser pp = factory.newPullParser();
    
      // 2. setting options
      // ex. disabling mixed content for elements
      // (element can not have elements mixed with non-whitespace string content)
      pp.setAllowedMixedContent(false);
    
      // 3. setting input
      String data = "<hello>World!</hello>";
      // input will be taken from java.io.Reader
      pp.setInput(new StringReader(data));
    
      // input could be also taken from String directly:
      //pp.setInput(data.toCharArray());
    
      // 4. parsing
    
      //declare variables used during parsing
      byte type;  // received event type
      XmlStartTag stag = factory.newStartTag();
      XmlEndTag etag = factory.newEndTag();
    
      // start parsing loop
      while((type = pp.next()) != XmlPullParser.END_DOCUMENT) {
        if(type == XmlPullParser.CONTENT) {
          String s = pp.readContent();
          System.out.println("CONTENT={'"+s+"'}");
        } else if(type == XmlPullParser.END_TAG) {
          pp.readEndTag(etag);
          System.out.println(""+etag);
        } else if(type == XmlPullParser.START_TAG) {
          pp.readStartTag(stag);
          System.out.println(""+stag);
        }
      }
    

    After parsing is finished, parser instance may be reused by calling again {@link org.gjt.xpp.XmlPullParser#setInput(Reader)}.

    Example Java code that will read string for SOAP encoding

      public String readString(XmlPullParser pp, XmlStartTag stag)
        throws DeserializeException, XmlPullParserException, IOException
      {
        String xs = stag.getAttributeValue(Soap.XSI_NS, "null");
        if( "1".equals(xs) ) {
          if(pp.next() != XmlPullParser.END_TAG)
            throw new DeserializeException("expected end tag");
          return null;
        }
        if(pp.next() != XmlPullParser.CONTENT)
          throw new DeserializeException("expected content");
        String content = pp.readContent();
        if(pp.next() != XmlPullParser.END_TAG)
          throw new DeserializeException("expected end tag");
        return content;
      }
    


    Aleksander Slominski

    Last modified: $Id: package.html,v 1.4 2002/12/11 01:49:32 aslom Exp $ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlEndTag.java0000644000175000017500000000702707755336256023401 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlEndTag.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; /** * This represent XML end tag. It is a separate interface from XmlTag * to make clear distinction between XmlEndTag and XmlStartTag and as * well to emphasize that both are XML elements (so share XmlTag). * * @see XmlStartTag * @see XmlTag * @author Aleksander Slominski */ public interface XmlEndTag extends XmlTag { public void resetEndTag(); } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlFormatter.java0000644000175000017500000000736507755336256024207 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlFormatter.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; /** * This interface extends XmlRecorder to give some control * over formattingof XML output. * * @see XmlRecorder * @author Aleksander Slominski */ public interface XmlFormatter extends XmlRecorder { /** * Should new line be added after end tag? * @see #setEndTagNewLine */ public boolean isEndTagNewLine(); /** * Should new line be added after end tag? *

    NOTE: setting it to true will affect output XML * parsing when there are elements with mixed content allowed! */ public void setEndTagNewLine(boolean enable); } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlNode.java0000644000175000017500000001727007755336256023125 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlNode.java,v 1.5 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; import java.util.Enumeration; /** * This class represents XML subtree. * XmlNode is extension of XmlStartTag adding support for children * (some of them may be also XmlNode so we get recursively built tree) * and namespaces declarations associated with this node. * When node has no children and namespaces declared it is * essentially equivalent to XmlStartTag. * *

    When XmlNode user does not need namespaces then namespace related * methods may be ignored. However to use namespaces it is required to:

      *
    • call setDefaultNamespaceUri() to associate default namespace * in which this node is declared *
    • and to declare additional namespaces (as of xmlns:prefix="...") * with calling first removeNamespaces() and then addNamespaces() *
    * * @see XmlStartTag * @author Aleksander Slominski */ public interface XmlNode extends XmlStartTag { /** * Clear all Tag state to default values. */ public void resetNode(); /** context sensitive factory method to create the same type of node */ public XmlNode newNode() throws XmlPullParserException; public XmlNode newNode(String amespaceUri, String localName) throws XmlPullParserException; public XmlNode getParentNode(); public void setParentNode(XmlNode parent) throws XmlPullParserException; // public Object getFirstChild() // throws XmlPullParserException; // public Object getNextSibling() // throws XmlPullParserException; public Enumeration children(); /** it may need to reconsruct whole subtree to get count ... */ public int getChildrenCount(); public Object getChildAt(int pos); // ---------------- modifiable public void appendChild(Object child) throws XmlPullParserException; public void insertChildAt(int pos, Object child) throws XmlPullParserException; public void removeChildAt(int pos) throws XmlPullParserException; public void replaceChildAt(int pos, Object child) throws XmlPullParserException; public void ensureChildrenCapacity(int minCapacity) throws XmlPullParserException; /** * Removes all children - every child that was * implementing XmlNode will have set parent to null. */ public void removeChildren() throws XmlPullParserException; // ---------------- namespace related methods -- pain... //NOTE: this is initialized based on "namespace" xmlns attributes... /** * Return local part of qname. * For example for 'xsi:type' it returns 'type'. */ public String getQNameLocal(String qName) throws XmlPullParserException; /** * Return uri part of qname. * The return value is dependent on declared namespaces in this * node and possible when looking for value in parent node. * For example for 'xsi:type' if xsi namespace prefix * was declared to 'http://foo' it will return 'http://foo'. */ public String getQNameUri(String qName) throws XmlPullParserException; /** return namespace for prefix searching node tree upward. */ public String prefix2Namespace(String prefix) throws XmlPullParserException; /** return prefix for namesapce searching node tree upward. */ public String namespace2Prefix(String namespaceUri) throws XmlPullParserException; /** Namesapce URI associated with default namesapce prefix (xmlns='....') */ public String getDefaultNamespaceUri(); /** Set default namesapce URI (xmlns='....') */ public void setDefaultNamespaceUri(String defaultNamespaceUri) throws XmlPullParserException; public int getDeclaredNamespaceLength(); public void readDeclaredNamespaceUris(String[] uris, int off, int len) throws XmlPullParserException; public void readDeclaredPrefixes(String[] prefixes, int off, int len) throws XmlPullParserException; public void ensureDeclaredNamespacesCapacity(int minCapacity) throws XmlPullParserException; public void addNamespaceDeclaration( String prefix, String namespaceUri) throws XmlPullParserException; /** * NOTE: node SHOULD NOT keep references to passed arrays! */ public void addDeclaredNamespaces( String[] prefix, int off, int len, String[] namespaceUri) throws XmlPullParserException; public void removeDeclaredNamespaces() throws XmlPullParserException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullNode.java0000644000175000017500000001325307755336256023757 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullNode.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; import java.util.Enumeration; import org.gjt.xpp.XmlNode; /** * This class represents pullable XML subtree - children are built on * demand. * * @see org.gjt.xpp.XmlNode * @author Aleksander Slominski */ public interface XmlPullNode extends XmlNode { public void resetPullNode(); public XmlNode newNode() throws XmlPullParserException; public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException; /** * Is pull parsing of node finished. */ public boolean isFinished(); /** * Get parser that is use to build this node tree * and this pull node becomes finished - the caller is responsibile * to move pull parser state to the end tag of this node * (or parent pull node will be left in unconsistent state!!!!). * The returned pull parser position will be before start tag * of next child or before final end tag and the caller * should use next() to move parser to start reading children. * The node state becomes finished and subsequent call to * this method will throw exception until setPullParser() is called. * The final effect should be equivalen to calling skipNode()! *

    NOTE: this pull node must be in unfinished state * or exception will be thrown */ public XmlPullParser getPullParser() throws IOException, XmlPullParserException; /** Reset pull node to use pull parser. Pull Parser must be on START_TAG */ public void setPullParser(XmlPullParser pp) throws XmlPullParserException; public int getChildrenCountSoFar(); /** * This is not recommened method to pull children when node is not * finished (use readNextChild() instead) as Enumeration interface * does not allow to throw XmlPullParserException * so any parsing exeption is wrapped into RuntimeException * making code more messy... * * @see #readNextChild() */ public Enumeration children(); /** * This is preferred method to pull children * (children() requires .wrapping object Enumeration). * * @see #children() * @return next child (which is String or XmlPullNode) or * null if there is no re children */ public Object readNextChild() throws XmlPullParserException, IOException; /** * Read all reminaing children up to end tag. */ public void readChildren() throws XmlPullParserException, IOException; public void skipChildren() throws XmlPullParserException, IOException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullParser.java0000644000175000017500000002523407755336256024330 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullParser.java,v 1.7 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.IOException; import java.io.Reader; /** * Generic interface for simple and quick XML Pull Parser. * * @see XmlPullParserFactory * @author Aleksander Slominski */ public interface XmlPullParser { // public static final XmlPullParserEvent END_DOCUMENT = // XmlPullParserEvent.END_DOCUMENT; // // public static final XmlPullParserEvent START_TAG = // XmlPullParserEvent.START_TAG; // // /** end tag was just read */ // public static final XmlPullParserEvent END_TAG = // XmlPullParserEvent.END_TAG; // // /** element content was just read */ // public static final XmlPullParserEvent CONTENT = // XmlPullParserEvent.CONTENT; /** signal logical end of xml document */ public final static byte END_DOCUMENT = 1; /** start tag was just read */ public final static byte START_TAG = 2; /** end tag was just read */ public final static byte END_TAG = 3; /** element content was just read */ public final static byte CONTENT = 4; /** * Set the input for parser. */ public void setInput(Reader in) throws XmlPullParserException; /** * Set the input for parser. */ public void setInput(char[] buf) throws XmlPullParserException; /** * Set the input for parser. */ public void setInput(char[] buf, int off, int len) throws XmlPullParserException; /** * Reset the parser state. */ public void reset() throws XmlPullParserException; /** * Is mixed element context allowed? */ public boolean isAllowedMixedContent(); /** * Allow for mixed element content. Disabled by default. * When disbaled element must containt either text or other elements. * *

    NOTE: this is not resetable parameter. * */ public void setAllowedMixedContent(boolean enable) throws XmlPullParserException; /** * Is parser namespace aware? */ public boolean isNamespaceAware(); /** * Indicate that the parser understands XML Namespaces * *

    NOTE: this is not resetable parameter. * */ public void setNamespaceAware(boolean enable) throws XmlPullParserException; /** * Is parser going to report namespace attributes (xmlns*) ? */ public boolean isNamespaceAttributesReporting(); /** * Make parser to report xmlns* attributes. Disabled by default. * Only meaningful when namespaces are enabled (when namespaces * are disabled all attributes are always reported). */ public void setNamespaceAttributesReporting(boolean enable) throws XmlPullParserException; /** * Returns the namespace URI of the current element * Returns null if not applicable * (current event must be START_TAG or END_TAG) */ public String getNamespaceUri(); /** * Returns the local name of the current element * (current event must be START_TAG or END_TAG) */ public String getLocalName(); /** * Returns the prefix of the current element * or null if elemet has no prefix. * (current event must be START_TAG or END_TAG) */ public String getPrefix(); /** * Returns the raw name (prefix + ':' + localName) of the current element * (current event must be START_TAG or END_TAG) */ public String getRawName(); /** * Return local part of qname. * For example for 'xsi:type' it returns 'type'. */ public String getQNameLocal(String qName) throws XmlPullParserException; /** * Return uri part of qname. * It is depending on current state of parser to find * what namespace uri is mapped from namespace prefix. * For example for 'xsi:type' if xsi namespace prefix * was declared to 'urn:foo' it will return 'urn:foo'. */ public String getQNameUri(String qName) throws XmlPullParserException; /** * Returns the current depth of the element. */ public int getDepth(); public int getNamespacesLength(int depth); /** * Return namespace prefixes for element at depth */ public void readNamespacesPrefixes(int depth, String[] prefixes, int off, int len) throws XmlPullParserException; /** * Return namespace URIs for element at depth */ public void readNamespacesUris(int depth, String[] uris, int off, int len) throws XmlPullParserException; // --- miscellaneous reporting methods /** * */ public String getPosDesc(); /** * */ public int getLineNumber(); /** * */ public int getColumnNumber(); // --- methods doing real work /** * Get next parsing event. *

    NOTE: empty element (such as <tag/>) will be reported * with just two events: START_TAG, END_TAG - it must be so to preserve * parsing equivalency of empty element to <tag></tag>. */ public byte next() throws XmlPullParserException, IOException; /** * Returns the type of the current element (START_TAG, END_TAG, CONTENT, etc) */ public byte getEventType() throws XmlPullParserException; /** * Check if last CONTENT contained only whitespace characters. */ public boolean isWhitespaceContent() throws XmlPullParserException; /** * Return how big is content. * *

    NOTE: parser must be on CONTENT event. */ public int getContentLength() throws XmlPullParserException; /** * Read current content as Stirng. * *

    NOTE: parser must be on CONTENT event. */ public String readContent() throws XmlPullParserException; /** * Read current end tag. * *

    NOTE: parser must be on END_TAG event. */ public void readEndTag(XmlEndTag etag) throws XmlPullParserException; /** * Read current start tag. * *

    NOTE: parser must be on START_TAG event. */ public void readStartTag(XmlStartTag stag) throws XmlPullParserException; /** * Read node: it calls readStartTag and then if parser is namespaces * aware currently declared nemaspeces will be added * and defaultNamespace will be set. * *

    NOTE: parser must be on START_TAG event. * and all events will written into node! */ public void readNodeWithoutChildren(XmlNode node) throws XmlPullParserException; /** * Read subtree into node: call readNodeWithoutChildren * and then parse subtree adding children * (values obtained with readXontent or readNodeWithoutChildren). * *

    NOTE: parser must be on START_TAG event. * and all events will written into node! * */ public byte readNode(XmlNode node) throws XmlPullParserException, IOException; /** * Goes directly to the next sibling * *

    NOTE: parser must be on START_TAG event. * and all intermittent events will be lost! * */ public byte skipNode() throws XmlPullParserException, IOException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullParserBufferControl.java0000644000175000017500000000763707755336256027032 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullParserBufferControl.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.IOException; import java.io.Reader; /** * Additional interface to control XML Pull Parser buffering. * * @see XmlPullParserFactory * @author Aleksander Slominski */ public interface XmlPullParserBufferControl { // low level API: interface to parser internal data - good for perf public int getHardLimit(); public void setHardLimit(int value) throws XmlPullParserException; public int getSoftLimit(); public void setSoftLimit(int value) throws XmlPullParserException; public int getBufferShrinkOffset(); public void setBufferShrinkable(boolean shrinkable) throws XmlPullParserException; public boolean isBufferShrinkable(); } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullParserEventPosition.java0000644000175000017500000000745007755336256027057 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullParserEventPosition.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.IOException; import java.io.Reader; /** * Special interface to retrieve event positioning information. * * @see XmlPullParserFactory * @author Aleksander Slominski */ public interface XmlPullParserEventPosition { public int getEventStart(); // eventStart = tokenizer.posEnd, parsing..., eventEnd = tokenizer.posEnd } public int getEventEnd(); // == tokenizer.buf ALWAYS (never tokenizer.pc) /**

    NOTE: This may be internal buffer and is valud * only until call to method next()- do NOT attempt modify ! */ public char[] getEventBuffer(); } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullParserException.java0000644000175000017500000001120707755336256026202 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullParserException.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; /** * This exception is thrown to signal XML Pull Parser related excepions. * * @author Aleksander Slominski */ public class XmlPullParserException extends Exception { protected Throwable detail; protected int row = -1; protected int column = -1; public XmlPullParserException() { } public XmlPullParserException(String s) { super(s); } public XmlPullParserException(String s, Throwable thrwble) { super(s); this.detail = thrwble; } public XmlPullParserException(Throwable thrwble) { this("Pull Parser exception", thrwble); } public XmlPullParserException(String s, int row, int column) { super(s); this.row = row; this.column = column; } public Throwable getDetail() { return detail; } public void setDetail(Throwable cause) { this.detail = cause; } public int getLineNumber() { return row; } public int getColumnNumber() { return column; } public String getMessage() { if(detail == null) return super.getMessage(); else return super.getMessage() + "; nested exception is: \n\t" + detail.getMessage(); } //NOTE: code that prints this and detail is difficult in J2ME public void printStackTrace() { if (detail == null) { super.printStackTrace(); } else { synchronized(System.err) { System.err.println(super.getMessage() + "; nested exception is:"); detail.printStackTrace(); } } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlPullParserFactory.java0000644000175000017500000004225407755336256025661 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlPullParserFactory.java,v 1.8 2003/10/16 18:35:28 aslom Exp $ */ package org.gjt.xpp; import java.io.InputStream; import java.io.IOException; import java.io.Reader; import java.io.Writer; /** * This class is used to create implementations of XML Pull Parser. * Based on JAXP ideas but tailored to work in J2ME environments * (no access to system properties or file system). * * @see XmlPullParser * @author Aleksander Slominski */ public class XmlPullParserFactory { private static final boolean DEBUG = false; public static final String DEFAULT_PROPERTY_NAME = "org.gjt.xpp.XmlPullParserFactory"; //private static Class MY_CLASS; private static Object MY_REF = new XmlPullParserFactory(); private static final String DEFAULT_FULL_IMPL_FACTORY_CLASS_NAME = "org.gjt.xpp.impl.PullParserFactoryFullImpl"; private static final String DEFAULT_SMALL_IMPL_FACTORY_CLASS_NAME = "org.gjt.xpp.impl.PullParserFactorySmallImpl"; private static final String DEFAULT_RESOURCE_NAME = "/META-INF/services/" + DEFAULT_PROPERTY_NAME; private static String foundFactoryClassName = null; private boolean namespaceAware; /** * Proteted constructor to be called by factory implementations. */ protected XmlPullParserFactory() { } /** * Get a new instance of a PullParserFactory used to create XPP. */ public static XmlPullParserFactory newInstance() throws XmlPullParserException { return newInstance(null, null); } /** * Get a new instance of a PullParserFactory from given class name. * * @param factoryClassName use specified factory class if not null */ public static XmlPullParserFactory newInstance(String factoryClassName) throws XmlPullParserException { return newInstance( null, factoryClassName ); } /** * Get a new instance of a PullParserFactory used to create XPP. *

    NOTE: passing classLoaderCtx is not very useful in ME * but can be useful in container environment where * multiple class loaders are used * (it is using Class as ClassLoader is not in ME profile). * * @param classLoaderCtx if not null it is used to find * default factory and to create instance */ public static XmlPullParserFactory newInstance(Class classLoaderCtx) throws XmlPullParserException { return newInstance( classLoaderCtx, null ); } private final static String PREFIX = "DEBUG XPP2 factory: "; private static void debug(String msg) { if(!DEBUG) throw new RuntimeException( "only when DEBUG enabled can print messages"); System.err.println(PREFIX+msg); } /** * Get instance of XML pull parser factiry. * *

    NOTE: this allows to use elegantly -D system properties or * similar configuratin in ME environments.. * * @param classLoaderCtx if null Class.forName will be used instead * - simple way to use class loaders and still have ME compatibility! * @param hint with name of parser factory to use - * it is a hint and is ignored if factory is not available. */ private static XmlPullParserFactory newInstance(Class classLoaderCtx, String factoryClassName) throws XmlPullParserException { // if user hinted factory then try to use it ... XmlPullParserFactory factoryImpl = null; if(factoryClassName != null) { try { //* Class clazz = null; if(classLoaderCtx != null) { clazz = classLoaderCtx.forName(factoryClassName); } else { clazz = Class.forName(factoryClassName); } factoryImpl = (XmlPullParserFactory) clazz.newInstance(); //foundFactoryClassName = factoryClassName; //*/ if(DEBUG) debug("loaded "+clazz); } catch (Exception ex) { if(DEBUG) debug("failed to load "+factoryClassName); if(DEBUG) ex.printStackTrace(); } } // if could not load then proceed with pre-configured if(factoryImpl == null) { // default factory is unknown - try to find it! if(foundFactoryClassName == null) { findFactoryClassName( classLoaderCtx ); } if(foundFactoryClassName != null) { try { Class clazz = null; if(classLoaderCtx != null) { clazz = classLoaderCtx.forName(foundFactoryClassName); } else { clazz = Class.forName(foundFactoryClassName); } factoryImpl = (XmlPullParserFactory) clazz.newInstance(); if(DEBUG) debug("loaded pre-configured "+clazz); } catch (Exception ex) { if(DEBUG) debug("failed to use pre-configured " +foundFactoryClassName); if(DEBUG) ex.printStackTrace(); } } } // still could not load then proceed with default if(factoryImpl == null) { try { Class clazz = null; factoryClassName = DEFAULT_FULL_IMPL_FACTORY_CLASS_NAME; // give one more chance for small implementation if(classLoaderCtx != null) { clazz = classLoaderCtx.forName(factoryClassName); } else { clazz = Class.forName(factoryClassName); } factoryImpl = (XmlPullParserFactory) clazz.newInstance(); if(DEBUG) debug("using default full implementation " +factoryImpl); // make it as pre-configured default foundFactoryClassName = factoryClassName; } catch( Exception ex2) { try { Class clazz = null; factoryClassName = DEFAULT_SMALL_IMPL_FACTORY_CLASS_NAME; // give one more chance for small implementation if(classLoaderCtx != null) { clazz = classLoaderCtx.forName(factoryClassName); } else { clazz = Class.forName(factoryClassName); } factoryImpl = (XmlPullParserFactory) clazz.newInstance(); if(DEBUG) debug("no factory was found instead "+ "using small default impl "+factoryImpl); // now it is pre-configured default foundFactoryClassName = factoryClassName; } catch( Exception ex3) { throw new XmlPullParserException( "could not load any factory class "+ "(even small or full default implementation)", ex3); } } } // return what was found.. if(factoryImpl == null) throw new RuntimeException( "XPP2: internal parser factory error"); return factoryImpl; } // --- private utility methods private static void findFactoryClassName( Class classLoaderCtx ) { if(foundFactoryClassName != null) //return; // foundFactoryClassName; throw new RuntimeException("internal XPP2 initialization error"); InputStream is = null; try { if(classLoaderCtx != null) { if(DEBUG) debug( "trying to load "+DEFAULT_RESOURCE_NAME+ " from "+classLoaderCtx); is = classLoaderCtx.getResourceAsStream( DEFAULT_RESOURCE_NAME ); } if(is == null) { Class klass = MY_REF.getClass(); //XmlPullParserFactory.getClass(); if(DEBUG) debug( "opening "+DEFAULT_RESOURCE_NAME+ " (class context "+klass+")"); is = klass.getResourceAsStream( DEFAULT_RESOURCE_NAME ); } if( is != null ) { foundFactoryClassName = readLine( is ); if( DEBUG ) debug( "foundFactoryClassName=" + foundFactoryClassName ); //if( foundFactoryClassName != null // && ! "".equals( foundFactoryClassName ) ) { // return foundFactoryClassName; //} } } catch( Exception ex ) { if( DEBUG ) ex.printStackTrace(); } finally { if(is != null) { try { is.close(); } catch(Exception ex) { } } } //return foundFactoryClassName; } private static String readLine(InputStream input) throws IOException { StringBuffer sb = new StringBuffer(); while (true) { int ch = input.read(); if (ch < 0) { break; } else if (ch == '\n') { break; } sb.append((char) ch); } // strip end-of-line \r\n if necessary int n = sb.length(); if ((n > 0) && (sb.charAt(n - 1) == '\r')) { sb.setLength(n - 1); } return (sb.toString()); } /** * Specifies that the parser produced by this factory will provide * support for XML namespaces. * By default the value of this is set to false. * * @param awareness true if the parser produced by this code * will provide support for XML namespaces; false otherwise. */ public void setNamespaceAware(boolean awareness) throws XmlPullParserException { namespaceAware = awareness; } /** * Indicates whether or not the factory is configured to produce * parsers which are namespace aware. * * @return true if the factory is configured to produce parsers * which are namespace aware; false otherwise. */ public boolean isNamespaceAware() { return namespaceAware; } /** * Create new XML pull parser. */ public XmlPullParser newPullParser() throws XmlPullParserException { throw new XmlPullParserException("newPullParser() not implemented"); } /** * Create new end tag. */ public XmlEndTag newEndTag() throws XmlPullParserException { throw new XmlPullParserException("newEndTag() not implemented"); } /** * Return new XML node. */ public XmlNode newNode() throws XmlPullParserException { throw new XmlPullParserException("newNode() not implemented"); } /** * Return new XML node that is represeting tree from current pull parser start tag. */ public XmlNode newNode(XmlPullParser pp) throws XmlPullParserException, IOException { XmlNode node = newNode(); pp.readNode(node); return node; } /** * Return new XML pull node that is represeting tree from current pull parser start tag. */ public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException { throw new XmlPullParserException("newPullNode() not implemented"); } /** * Return new XML start tag. */ public XmlStartTag newStartTag() throws XmlPullParserException { throw new XmlPullParserException("newStartTag() not implemented"); } /** * Return new XML formatter. */ public XmlFormatter newFormatter() throws XmlPullParserException { throw new XmlPullParserException("newFormatter() not implemented"); } /** * Return new XML recorder. */ public XmlRecorder newRecorder() throws XmlPullParserException { throw new XmlPullParserException("newRecorder() not implemented"); } // some utility methods as requested by users /** * Read XmlNode from input - essentially it is utility function that * will create instance of pull parser, feed input inpt it and * return new node tree parsed form the input. * If closeAtEnd is true clos() will be called on reader * */ public XmlNode readNode(Reader reader, boolean closeAtEnd) throws XmlPullParserException, IOException { XmlPullParser pp = newPullParser(); pp.setInput(reader); byte event = pp.next(); XmlNode doc = newNode(); if(event == XmlPullParser.START_TAG) { pp.readNode(doc); } else { if(event != XmlPullParser.END_DOCUMENT) { throw new XmlPullParserException( "coul dnot read node tree from input, unexpected parser state"+pp.getPosDesc()); } } if(closeAtEnd) { reader.close(); } return doc; } /** * Equivalent to calling readNode(reader, false); */ public XmlNode readNode(Reader reader) throws XmlPullParserException, IOException { return readNode(reader, false); } public void writeNode(XmlNode node, Writer writer, boolean closeAtEnd) throws XmlPullParserException, IOException { XmlRecorder recorder = newRecorder(); recorder.setOutput(writer); recorder.writeNode(node); if(closeAtEnd) { writer.close(); } } /** * Equivalent to calling writeNode(node, writer, false); */ public void writeNode(XmlNode node, Writer writer) throws XmlPullParserException, IOException { writeNode(node, writer, false); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlRecorder.java0000644000175000017500000001036507755336256024003 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlRecorder.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; /** * This class represents abstract functionality necessary to * to persist XML Pull Parser events. * * @see XmlWritable * @author Aleksander Slominski */ public interface XmlRecorder { public Writer getOutput() throws XmlPullParserException; public void setOutput(Writer out) throws XmlPullParserException; public void write(Object o) throws IOException, XmlPullParserException; public void writeXml(XmlWritable w) throws IOException, XmlPullParserException; public void writeContent(String s) throws IOException, XmlPullParserException; public void writeEndTag(XmlEndTag etag) throws IOException, XmlPullParserException; public void writeStartTag(XmlStartTag stag) throws IOException, XmlPullParserException; public void writeStartTagStart(XmlStartTag stag) throws IOException, XmlPullParserException; public void writeStartTagAsEndTag(XmlStartTag stag) throws IOException, XmlPullParserException; public void writeNode(XmlNode node) throws IOException, XmlPullParserException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlStartTag.java0000644000175000017500000001571607755336256023774 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlStartTag.java,v 1.7 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; /** * This class represents abstract functionality necessary to * to persist XML Pull Parser events. * * @see XmlTag * @see XmlNode * @author Aleksander Slominski */ public interface XmlStartTag extends XmlTag { /** * Clear all Tag state to default values. */ public void resetStartTag(); /** * Returns the number of attributes on the current element */ public int getAttributeCount(); /** * Returns the namespace URI of the specified attribute * number index (starts from 0). * (meaningful only if namespaces enabled) * Returns null if invalid index. */ public String getAttributeNamespaceUri(int index); /** * Returns the localname of the specified attribute * if namespaces enabled or just attribute name if namespaces disabled. * Returns null if invalid index. */ public String getAttributeLocalName(int index); /** * Returns the prefix of the specified attribute * Returns null if invalid index or if element has no prefix. */ public String getAttributePrefix(int index); /** * Returns the raw name of the specified attribute * Returns null if invalid index. */ public String getAttributeRawName(int index); /** * Returns the given attributes value * Returns null if invalid index. */ public String getAttributeValue(int index); /** * Returns the given attributes value * Returns null if no attribute with rawName. */ public String getAttributeValueFromRawName(String rawName); /** * Returns the given attributes value */ public String getAttributeValueFromName(String namespaceUri, String localName); /** * Return true if attribute at index is namespace declaration * such as xmlns='...' or xmlns:prefix='...' */ public boolean isAttributeNamespaceDeclaration(int index); // -- modfiable /** parameters modeled after SAX2 attribute approach */ public void addAttribute(String namespaceUri, String localName, String rawName, String value) throws XmlPullParserException; /** * * Parameter isNamespaceDeclaration if true indicates that attribute is related * to namespace management and may be ignored by normal processing *

    NOTE: this class has no support for resolving namespaces and * such support may be added later (see XmlNode and namespaces methids) */ public void addAttribute(String namespaceUri, String localName, String rawName, String value, boolean isNamespaceDeclaration) throws XmlPullParserException; /** * Pre-allocate if necessary tag data structure to hold * at least minCapacity attributes . */ public void ensureAttributesCapacity(int minCapacity) throws XmlPullParserException; /** remove all atribute */ public void removeAttributes() throws XmlPullParserException; /** * This method tries to remove attribute identified by namespace uti and local name. * @return true if attribute was removed or false otherwise. */ public boolean removeAttributeByName(String uri, String localName) throws XmlPullParserException; /** * This method tries to remove attribute identified by raw name. * @return true if attribute was removed or false otherwise. */ public boolean removeAttributeByRawName(String rawName) throws XmlPullParserException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlTag.java0000644000175000017500000001154507755336256022752 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlTag.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; /** * Base interface that encapsulates common functionality for * XML elements: both start tag and end tag * (an empty element is equivalent to start tag followed by * end tag so for simplicity ti is not modeled as a separate class). * * @see XmlStartTag * @see XmlEndTag * @author Aleksander Slominski */ public interface XmlTag { /** * Clear all Tag state to default values. */ public void resetTag(); /** * Returns the namespace URI of the current element * Returns null if not applicable */ public String getNamespaceUri(); //public void setNamespaceURI(String value) throws XmlPullParserException; /** * Returns the local name of the current element */ public String getLocalName(); //public void setLocalName(String value) throws XmlPullParserException; /** * Returns the prefix of the current element * or null if elemet has no prefix. */ public String getPrefix(); /** * Returns the raw name (prefix + ':' + localName) of the current element */ public String getRawName(); //public void setRawName(String value) throws XmlPullParserException; /** * Modify tag to have namespace URI, localName and rawName. * *

    NOTE: setting modeled after SAX2 startTag * * @param namespaceURI maybe null then default "" namespace is used * @param localName may be null then rawName is used * @param rawName actual attribute name MUST be not null * if it is null exception MUST be thrown */ public void modifyTag(String namespaceURI, String localName, String rawName) throws XmlPullParserException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/org/gjt/xpp/XmlWritable.java0000644000175000017500000000672007755336256024007 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlWritable.java,v 1.4 2003/04/06 00:03:59 aslom Exp $ */ package org.gjt.xpp; import java.io.*; /** * This interface can be used by classes that wishes to implement * its own way to persist XML into writer. * XmlRecorder is * * @see XmlRecorder * @author Aleksander Slominski */ public interface XmlWritable { public void writeXml(Writer out) throws IOException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/intf/README.txt0000644000175000017500000000011407755336265020215 0ustar wbaerwbaer00000000000000All XPP2 API is defined here - everything else is implementation detail :-) PullParser2.1.10/src/java/samples/0000755000175000017500000000000010232453172017204 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/commandline/0000755000175000017500000000000010232453172021472 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/commandline/BulkDataLoad.java0000644000175000017500000001531207755336256024651 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: $ */ package commandline; import java.io.*; import org.gjt.xpp.*; public class BulkDataLoad { public static void main(String[] args) throws Exception { BulkDataLoad runner = new BulkDataLoad(); runner.run(args); } public void run(String[] args) throws Exception { // 1. creating instance of parser XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser pp = factory.newPullParser(); // 2. setting options // ex. disabling mixed content for elements // (element can not have elements mixed with non-whitespace string content) pp.setAllowedMixedContent(false); // 3. setting input String data = " data1 \n data2 \n"+ " data3\n data4 "; // input will be taken from java.io.Reader pp.setInput(new StringReader(data)); // input could be also taken from String directly: //pp.setInput(data.toCharArray()); // 4. parsing //declare variables used during parsing XmlStartTag stag = factory.newStartTag(); XmlEndTag etag = factory.newEndTag(); byte type; // received event type byte prevType; // previous event type type = prevType = pp.next(); if(type == XmlPullParser.START_TAG) { pp.readStartTag(stag); //System.err.println("read start tag "+stag); if(! "test".equals(stag.getLocalName())) { throw new RuntimeException("bulk data must start with test not " +stag.getLocalName()+pp.getPosDesc()); } } else { throw new RuntimeException("unexpected end of data "+pp.getPosDesc()); } // start parsing loop for(;;) { type = pp.next(); if(type == XmlPullParser.START_TAG) { pp.readStartTag(stag); //System.err.println("read start tag "+stag); type = pp.next(); String content = ""; if(type == XmlPullParser.CONTENT) { content = pp.readContent(); //System.err.println("read content="+content); while(type != XmlPullParser.END_TAG) { try { type = pp.next(); } catch(Exception e){ System.err.println("ERROR recovering from "+e); // give it a second chance //type = pp.next(); type = pp.getEventType(); } } } if(type != XmlPullParser.END_TAG) { throw new RuntimeException("expected end tag not "+pp.getPosDesc()); } System.err.println("LOAD tag="+stag.getLocalName()+" data='"+content+"'"); } else if(type == XmlPullParser.END_TAG) { break; } else if(type == XmlPullParser.END_DOCUMENT) { throw new RuntimeException("unexpected end of data "+pp.getPosDesc()); } else { throw new RuntimeException("unknown event type: "+type); } } if(pp.next() != XmlPullParser.END_DOCUMENT) { throw new RuntimeException("expected end of data not "+pp.getPosDesc()); } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/commandline/SampleTreeApi.java0000644000175000017500000001274607755336256025065 0ustar wbaerwbaer00000000000000/* * Copyright (c) 2000-2001 Sosnoski Software Solutions, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ package commandline; import java.io.*; import org.gjt.xpp.*; /** * XPP usage example code. Contains the example methods which perform * the processing of an input document. * * @author Dennis M. Sosnoski * @author Aleksander Slominski [http://www.extreme.indiana.edu/~aslom/] * @version 1.2 */ public class SampleTreeApi { protected int m_elements; protected int m_adds; protected int m_deletes; /** Pull parser factory used within a test run. */ protected XmlPullParserFactory m_parserFactory; /** * Modify subtree for element. This recursively walks through the document * nodes under an element, performing the modifications. * * @param element element to be walked */ protected void modifyElement(XmlNode element) throws Exception { // loop through child nodes for (int i = 0; i < element.getChildrenCount(); i++) { // handle child by node type Object child = element.getChildAt(i); if (child instanceof String) { // trim whitespace from content text String trimmed = child.toString().trim(); if (trimmed.length() == 0) { // delete child if only whitespace (adjusting index) element.removeChildAt(i--); m_deletes++; } else { // wrap the trimmed content with new element XmlNode text = element.newNode(element.getNamespaceUri(), "text"); text.appendChild(trimmed); element.replaceChildAt(i, text); m_adds++; } } else if (child instanceof XmlNode) { // handle child elements with recursive call modifyElement((XmlNode)child); m_elements++; } } } /** * Process document file. This override of the abstract base class method * demonstrates document handling for this representation. * * @param in input stream for reading document text * @param out output stream for writing document text * @throws Exception anything thrown by example code */ protected void processFile(String fileName, InputStream in, OutputStream out) throws Exception { // setup XPP2 factory m_parserFactory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME)); System.out.println("using factory "+m_parserFactory.getClass()); m_parserFactory.setNamespaceAware(true); // parse the document from input stream XmlNode doc = m_parserFactory.readNode(new BufferedReader(new InputStreamReader(in))); // recursively walk and modify document m_elements++; modifyElement(doc); // write the document to output stream m_parserFactory.writeNode(doc, new OutputStreamWriter(out), true); // statistics // System.out.println("\n elements: "+m_elements // +" adds: "+m_adds // +" deletes: "+m_deletes); System.out.println("\n\n"+fileName+": " +""+m_elements+" elements visited, " +m_adds+" text wrappers added" +" and "+m_deletes+" whitespace content deleted"); } /** * Main execution method. Just creates an instance of the class and passes * the file list to the base class method for processing. * * @param argv command line arguments */ public static void main(String[] args) throws Exception { if(args.length != 1) { System.err.println("required argument with xnml file"); System.exit(1); } InputStream in = new FileInputStream(args[0]); OutputStream out = new PrintStream(System.err); new SampleTreeApi().processFile(args[0], in, out); } } PullParser2.1.10/src/java/samples/commandline/XppCountMain.java0000644000175000017500000002511507755336256024751 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XppCountMain.java,v 1.4 2003/04/06 00:04:01 aslom Exp $ */ package commandline; import java.io.*; import shared.count.ProgressObserver; import shared.count.ReaderFactory; import shared.count.XppCount; public class XppCountMain implements ProgressObserver, ReaderFactory { // when enabled do not use whole file buffering private boolean hugeFiles; // file content read into string private String fileContent; private boolean trace; private boolean verbose; private boolean nowait; private String xmlFile = "test.xml"; private String charsetName; public void print(String msg) { System.out.print(msg); } public void println(String msg) { System.out.println(msg); } public void trace(String msg) { if(trace) System.out.println(msg); } public void verbose(String msg) { if(verbose) System.out.println(msg); } public boolean stopRequested() { return false; } public Reader newReader() throws IOException { Reader r; if(hugeFiles) { trace("opening stream reader for file "+xmlFile); if(charsetName != null) { r = new InputStreamReader(openData(this.getClass(), xmlFile), charsetName); } else { r = new InputStreamReader(openData(this.getClass(), xmlFile)); } } else { if(fileContent == null) { trace("caching file content of "+xmlFile); fileContent = loadData(this.getClass(), xmlFile, charsetName); } trace("returning stream reader for cached "+xmlFile); r = new StringReader(fileContent); } return r; } public static void main(String[] args) throws Exception { XppCountMain runner = new XppCountMain(); runner.run(args); } public void run(String[] args) throws Exception { XppCount driver = new XppCount(); // allows user to provide system default -Dorg.gjt.xpp.XmlPullParserFactory=FACTORY_CLASS driver.factoryClassName = System.getProperty( org.gjt.xpp.XmlPullParserFactory.DEFAULT_PROPERTY_NAME); for(int i = 0; i < args.length; ++i) { String arg = args[i]; String value = null; if(i < args.length - 1) value = args[i + 1]; if(arg.charAt(0) == '-') { if(arg.equals("-help")) { usage(); } else if(arg.equals("-nowait")) { nowait = true; } else if(arg.equals("-hard")) { if(hugeFiles) { usage("before setting hard limit huge files must be enabled"); } if(value == null) usage(); driver.hardLimit = Integer.parseInt(value); ++i; } else if(arg.equals("-soft")) { if(hugeFiles) { usage("before setting soft limit huge files must be enabled"); } if(value == null) usage(); driver.softLimit = Integer.parseInt(value); ++i; } else if(arg.equals("-c")) { if(value == null) usage(); if(charsetName != null) { usage("charset name was already set to '"+charsetName+"' and not '"+value+"'"); } charsetName = value; ++i; } else if(arg.equals("-H")) { hugeFiles = true; } else if(arg.equals("-t")) { trace = true; } else if(arg.equals("-v")) { verbose = true; } else if(arg.equals("-n")) { driver.supportNamespaces = true; } else if(arg.equals("-s")) { //driver.speedTest = true; if(value == null) usage(); driver.speedTest = Integer.parseInt(value); ++i; } else if(arg.equals("-x")) { driver.disallowMixedContent = true; } else if(arg.equals("-f")) { if(driver.factoryClassName != null) { usage("factory class name already set to " +driver.factoryClassName ); } if(value == null) usage(); driver.factoryClassName = value; ++i; } else usage(); } else { xmlFile = arg; } } trace("parameters processed and starting test now..."); driver.runTest(xmlFile, this, this); } private void usage() { usage(null); } private void usage(String errMsg) { if(errMsg != null) { System.err.print( "Error: "+errMsg+"\n"); } System.err.print( "Usage\n" +" "+getClass().getName()+" [options] \n" +"\n" +"Options:\n" +" -c CHARSET_NAME\tUse charset for decoding input as defined in Java\n" +" \teg.: US-ASCII, ISO-8859-1, UTF-8, UTF-16) .\n" +" -f\tFactory class name to use. Defaults to system property if any.\n" +" -H\tEnable processing huge files (do not buffer whole file)\n" +" -n\tEnable namespace processing. Defaults to off.\n" +" -s COUNT\tRun speed test COUNT times.\n" +" -t\tPrint tracing output only. Defaults to off.\n" +" -v\tVerbose output. Defaults to off.\n" +" -x\tDisallow mixed content. Defaults to off.\n" +" -soft x\tSet soft limit to x on buffer size. Defaults to -1.\n" +" -hard x\tSet hard limit to x on buffer size. Defaults to -1.\n" +"\n" +"This program prints the number of elements, attributes,\n" +"white spaces and other non-white space characters in the input file.\n" +"\n" ); System.exit(1); } private static InputStream openData(Class klass, String name) throws IOException { final String RES_PREFIX = "/src/samples/common/count/"; InputStream in = null; try { in = new FileInputStream(name); } catch(IOException ex) { in = klass.getResourceAsStream( name ); if(in == null) { in = klass.getResourceAsStream(RES_PREFIX + name ); } } return in; } private static String loadData(Class klass, String name, String charsetName) throws IOException { InputStream in = openData(klass, name); if(in == null) { throw new IOException("can't load "+name); } Reader reader; if(charsetName != null) { reader = new InputStreamReader(new BufferedInputStream(in), charsetName); } else { reader = new InputStreamReader(new BufferedInputStream(in)); } StringWriter sink = new StringWriter(); char[] buf = new char[4096]; int got; while((got = reader.read(buf)) != -1) { sink.write(buf, 0, got); } return sink.toString(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/midlet/0000755000175000017500000000000010232453172020462 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/midlet/count_midlet.jad0000644000175000017500000000045307755336256023655 0ustar wbaerwbaer00000000000000MIDlet-Name: XppCount MIDlet-Version: 1.0 MIDlet-Vendor: Aleksander Slominski MIDlet-Description: Xml Pull Parser Sample. MicroEdition-Profile: MIDP-1.0 MicroEdition-Configuration: CLDC-1.0 MIDlet-1: XppCount, , midlet.XppCountMidlet MIDlet-Jar-URL: count_midlet.jar MIDlet-Jar-Size: 10745 PullParser2.1.10/src/java/samples/midlet/count_midlet_tiny.jad0000644000175000017500000000047107755336256024720 0ustar wbaerwbaer00000000000000MIDlet-Name: XppCountTiny MIDlet-Version: 1.0 MIDlet-Vendor: Aleksander Slominski MIDlet-Description: Xml Pull Parser Tiny Sample. MicroEdition-Profile: MIDP-1.0 MicroEdition-Configuration: CLDC-1.0 MIDlet-1: XppCount, , midlet.XppCountMidlet MIDlet-Jar-URL: count_midlet_tiny.jar MIDlet-Jar-Size: 10745 PullParser2.1.10/src/java/samples/midlet/XppCountMidlet.java0000644000175000017500000002604207755336256024273 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XppCountMidlet.java,v 1.3 2003/04/06 00:04:01 aslom Exp $ */ package midlet; import java.io.*; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import org.gjt.xpp.*; import shared.count.ProgressObserver; import shared.count.ReaderFactory; import shared.count.XppCount; /** * Simple Midlet to show XppCount working. */ public class XppCountMidlet extends MIDlet implements CommandListener, ProgressObserver, ReaderFactory, Runnable { private final static boolean DEBUG = false; Command exitCommand = new Command("Exit", Command.EXIT, 2); Command parseCommand = new Command("Parse", Command.SCREEN, 1); Command speedCommand = new Command("Test", Command.SCREEN, 1); Command okCommand = new Command("OK", Command.OK, 1); Display display; Form welcomeForm; TextField inputXml; TextBox parsingOutput; //Form outputForm; //TextField outputParsing; boolean stopped = true; boolean finishRun; char[] xmlContent; XppCount driver; Thread runner; public XppCountMidlet() {} private void debug(String msg) { // notice that J2ME output is at leat erratic.... // CAN NOT be depended for real debugging... if(DEBUG) System.err.println(msg); } public void startApp() throws MIDletStateChangeException { welcomeForm = new Form("XPP2 DEMO"); inputXml = new TextField( "Enter XML", "World! 10", 1000, TextField.ANY); welcomeForm.append(inputXml); welcomeForm.addCommand(parseCommand); welcomeForm.addCommand(exitCommand); welcomeForm.setCommandListener(this); // outputForm = new Form("Output"); // outputParsing = new TextField( // "", "", 1000, TextField.ANY); // outputForm.append(outputParsing); // outputForm.addCommand(okCommand); // outputForm.setCommandListener(this); parsingOutput = new TextBox( "Output", "", 1000, TextField.ANY); parsingOutput.setCommandListener(this); parsingOutput.addCommand(okCommand); parsingOutput.setCommandListener(this); display = Display.getDisplay(this); display.setCurrent(welcomeForm); driver = new XppCount(); runner = new Thread(this); finishRun = false; runner.start(); } public void pauseApp() { stopped = true; //display = null; } public void destroyApp(boolean unconditional) throws MIDletStateChangeException { finishRun = stopped = true; if (unconditional) { notifyDestroyed(); } else { } } public void commandAction(Command c, Displayable s) { try { debug("command="+c); if (c == exitCommand) { debug("EXIT pressed"); destroyApp(false); notifyDestroyed(); } else if (c == parseCommand) { debug("PARSE pressed"); parsingOutput.setString("Parsing...\n"); //outputParsing.setString("Parsing...\n"); //print("Now parsing started..."); display.setCurrent(parsingOutput); //display.setCurrent(outputForm); //transfer user input so be acccessd by newReader() xmlContent = new char[inputXml.size()]; inputXml.getChars(xmlContent); if(DEBUG) println("parsing requested"); debug("parsing requested"); //XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); //XmlPullParser pp = factory.newPullParser(); //pp.setInput(xmlContent); // while(!stopped) { // byte event = pp.next(); // int last = parsingOutput.size(); // parsingOutput.insert("X", last); // } stopped = false; //runTest(); // runner Thread will pick it up //runner.interrupt(); // not supported in J2ME Thread.currentThread().yield(); } else if (c == okCommand) { debug("OK pressed"); debug("parsing stopped"); stopped = true; display.setCurrent(welcomeForm); //runner.interrupt(); // not supported in J2ME Thread.currentThread().yield(); } else { debug("Unknown command "+c); } } catch (Exception ex) { debug(ex.toString()); ex.printStackTrace(); } } public void print(String msg) { int last = parsingOutput.size(); parsingOutput.insert(msg, last); // int last = outputParsing.size(); // outputParsing.insert(msg, last); } public void println(String msg) { print(msg+"\n"); } public void trace(String msg) { } public void verbose(String msg) { //println(msg); } public boolean stopRequested() { return stopped; } public Reader newReader() throws IOException { Reader r = new MyCharArrayReader(xmlContent); return r; } public void runTest() { try{ if(stopped == false) { debug("paring started..."); if(DEBUG) println("paring started..."); System.err.println("runtTest paring start"); driver.runTest("INTERNAL", this, this); stopped = true; debug("parsing finished"); if(DEBUG) println("paring finished."); } } catch(XmlPullParserException ex) { stopped = true; println("\nParsing error: "+ex.getMessage()); ex.printStackTrace(); } catch(java.io.IOException ex) { stopped = true; println("\nIO error: "+ex.getMessage()); ex.printStackTrace(); } catch(java.lang.Exception ex) { stopped = true; println("\nGeneric error: "+ex.getMessage()); ex.printStackTrace(); } } public void run() { // try { // XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); // XmlPullParser pp = factory.newPullParser(); // char[] data = new char[inputXml.size()]; // inputXml.getChars(data); // pp.setInput(data); // while(!stopped) { // byte event = pp.next(); // int last = parsingOutput.size(); // parsingOutput.insert("X", last); // } int count = 0; while(finishRun == false) { try { Thread.sleep(200); } catch(InterruptedException ex) { } //debug("RUN "+(count++)+" stopped="+stopped); //if(DEBUG) println("RUN "+(count++)+" "+stopped); runTest(); } } public class MyCharArrayReader extends Reader { char[] buf; int pos; public MyCharArrayReader(char[] buf) { this.buf = buf; pos = 0; } public int read(char[] cbuf, int off, int len) throws IOException { debug( "buf="+buf+" cbuf="+cbuf+" off="+off+" len="+len); int toRead = len; if(pos + toRead > buf.length) { toRead = buf.length - pos; } if(toRead == 0) return -1; System.arraycopy(buf, pos, cbuf, off, toRead); pos += toRead; return toRead; } public void close() throws IOException { if(pos >= buf.length) { throw new IOException( "attempt to close already closed reader"); } pos = buf.length; } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/shared/0000755000175000017500000000000007755336256020475 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/shared/count/0000755000175000017500000000000010232453172021602 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/shared/count/ProgressObserver.java0000644000175000017500000000657007755336256026014 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: ProgressObserver.java,v 1.3 2003/04/06 00:04:01 aslom Exp $ */ package shared.count; /** * Simple interface to allow watching XppCount progess. */ public interface ProgressObserver { public void print(String msg); public void println(String msg); public void trace(String msg); public void verbose(String msg); public boolean stopRequested(); } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/shared/count/ReaderFactory.java0000644000175000017500000000646307755336256025233 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: ReaderFactory.java,v 1.4 2003/04/06 00:04:01 aslom Exp $ */ package shared.count; import java.io.Reader; import java.io.IOException; /** * Simple interface to allow creating Readers for testing. */ public interface ReaderFactory { public Reader newReader() throws IOException; } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/shared/count/XppCount.java0000644000175000017500000002441107755336256024252 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XppCount.java,v 1.6 2003/04/06 00:04:01 aslom Exp $ */ package shared.count; import java.io.Reader; import java.io.IOException; import org.gjt.xpp.*; public class XppCount { // made public for simplicity ... public String factoryClassName; public boolean supportNamespaces; public boolean trace; public boolean disallowMixedContent; public int speedTest; public boolean nowait; public int softLimit = -1; public int hardLimit = -1; //parsing statistics public int attrCount; public int characterCount; public int elementCount; private XmlPullParser pp; private XmlStartTag stag; private XmlEndTag etag; private void setup(ProgressObserver po) throws XmlPullParserException { attrCount = characterCount = elementCount = 0; XmlPullParserFactory factory = XmlPullParserFactory.newInstance(factoryClassName); po.verbose("using factory "+factory.getClass()); etag = factory.newEndTag(); stag = factory.newStartTag(); pp = factory.newPullParser(); pp.setNamespaceAware(supportNamespaces); if(disallowMixedContent) pp.setAllowedMixedContent(false); // if(softLimit != -1) { // if(pp instanceof XmlPullParserBufferControl) { // ((XmlPullParserBufferControl)pp).setSoftLimit(softLimit); // } else { // po.verbose("could not set soft limit as this "+pp.getClass() // +" does not support interface "+XmlPullParserBufferControl.class); // } // } // if(hardLimit != -1) { // if(pp instanceof XmlPullParserBufferControl) { // ((XmlPullParserBufferControl)pp).setHardLimit(softLimit); // } else { // po.verbose("could not set hard limit as this "+pp.getClass() // +" does not support interface "+XmlPullParserBufferControl.class); // } // } } private void tearDown() { pp = null; } /** * Run speed test - return wall time in miliseconds */ private long speedTest( ReaderFactory readerFactory, ProgressObserver po) throws XmlPullParserException, IOException { final int runs = speedTest; if(speedTest <= 0) throw new IllegalArgumentException( "speedTest count must be positive not "+speedTest); final long startMillis = System.currentTimeMillis(); for(int i = 0; i < runs; ++i) { if(po.stopRequested()) { po.println("Parsing interrupted!"); return -1; } Reader reader = readerFactory.newReader(); pp.setInput(reader); byte type; while((type = pp.next()) != XmlPullParser.END_DOCUMENT) { if(type == XmlPullParser.CONTENT) { //String s = pp.readContent(); //characterCount += s.length(); characterCount += pp.getContentLength(); } else if(type == XmlPullParser.START_TAG) { pp.readStartTag(stag); ++elementCount; attrCount += stag.getAttributeCount(); } } reader.close(); } final long endMillis = System.currentTimeMillis(); final long walltimeMillis = endMillis - startMillis; return walltimeMillis; } private void prettyParse(Reader r, ProgressObserver po) throws XmlPullParserException, IOException { pp.setInput(r); byte type; while((type = pp.next()) != XmlPullParser.END_DOCUMENT) { if(po.stopRequested()) { po.println("Parsing interrupted!"); break; } if(type == XmlPullParser.CONTENT) { String s = pp.readContent(); po.println("Content={'"+escape(s)+"'}"); characterCount += s.length(); } else if(type == XmlPullParser.END_TAG) { pp.readEndTag(etag); po.println(""+etag); } else if(type == XmlPullParser.START_TAG) { pp.readStartTag(stag); po.println(""+stag); ++elementCount; attrCount += stag.getAttributeCount(); } } } private static String escape(String s) { StringBuffer buf = new StringBuffer(s.length()); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if(c == '\n') { buf.append("\\n"); } else if(c == '\r') { buf.append("\\r"); } else if(c == '\t') { buf.append("\\t"); } else if(c == '\\') { buf.append("\\"); } else if(c == '"') { buf.append('"'); } else if(c < 32) { buf.append("\\x"+Integer.toHexString(c)); } else { buf.append(c); } } return buf.toString(); } private static String to1000th(long v) { long vM = v % 1000; String sM = "" + vM; if(sM.length() == 1) { sM = "00" + sM; } else if(sM.length() == 2) { sM = "0" + sM; } String s = v / 1000 + "." + sM; return s; } public void runTest(String inputName, ReaderFactory rf, ProgressObserver po) throws XmlPullParserException, IOException { setup(po); if(speedTest > 0) { po.verbose("run speed test for "+inputName+" "+ speedTest+" times"); long walltime = speedTest(rf, po); if(walltime > 0) { //long duration = walltime / speedTest; po.print( inputName + ": "); // all this pain as J2ME does not support double/float String ms = to1000th((1000 * walltime) / speedTest); String s = to1000th(walltime); po.println("parse duration " + ms + " [ms]" +" total: " + s + " [s]"); } } else { po.verbose("pretty printing parsed input "+inputName); po.verbose("================ START PARSING: "+inputName); Reader r = rf.newReader(); prettyParse(r, po); po.verbose("================ END PARSING"); } po.println("statistics: " + elementCount + " elems, " + attrCount + " attrs, " + characterCount + " chars" ); tearDown(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/swing/0000755000175000017500000000000010232453172020333 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/samples/swing/XmlNodeToTreeModelAdapter.java0000644000175000017500000001126307755336256026177 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XmlNodeToTreeModelAdapter.java,v 1.3 2003/04/06 00:04:01 aslom Exp $ */ package swing; import javax.swing.*; import javax.swing.tree.*; import javax.swing.event.TreeModelListener; import org.gjt.xpp.*; public class XmlNodeToTreeModelAdapter implements TreeModel { protected XmlNode root; public XmlNodeToTreeModelAdapter(XmlNode root) { this.root = root; } public Object getRoot() { return root; } public boolean isLeaf(Object o) { return (o instanceof XmlNode) == false; } public int getChildCount(Object parent) { if(parent instanceof XmlNode) { int count = ((XmlNode)parent).getChildrenCount(); // do not display emty content... if(count == 1) { Object onlyChild = ((XmlNode)parent).getChildAt(0); if(onlyChild instanceof String) { if( ((String)onlyChild).length() == 0) { return 0; } } } return count; } return 0; } public Object getChild(Object parent, int index) { Object o = null; if(parent instanceof XmlNode) { o = ((XmlNode)parent).getChildAt(index); } return o; } public int getIndexOfChild(Object parentO, Object child) { if(parentO instanceof XmlNode) { XmlNode parent = (XmlNode)parentO; int count = parent.getChildrenCount(); for (int i = 0; i < count; ++i) { Object c = parent.getChildAt(i); if (c == child) return i; } } return -1; } // not implemented but required by tree model... public void valueForPathChanged(TreePath path, Object newValue) {} public void addTreeModelListener(TreeModelListener listener) {} public void removeTreeModelListener(TreeModelListener listener) {} } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/swing/XppNodeTree.java0000644000175000017500000001671407755336256023427 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: XppNodeTree.java,v 1.4 2003/04/06 00:04:01 aslom Exp $ */ package swing; import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.tree.*; import org.gjt.xpp.*; public class XppNodeTree extends JTree { static final int HEIGHT = 460; static final int WIDTH = 540; public XppNodeTree(TreeModel newModel) { super(newModel); } public String convertValueToText(Object node, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { //return "ALEK "+value.toString(); if(node instanceof XmlNode) { XmlNode xnode = (XmlNode)node; StringBuffer buf = new StringBuffer(""); //Node:"); buf.append(xnode.getRawName()); for (int i = 0; i < xnode.getAttributeCount(); i++) { buf.append(" "); buf.append(xnode.getAttributeRawName(i)); buf.append("='"); buf.append(xnode.getAttributeValue(i)); buf.append("'"); } return buf.toString(); } else { return node.toString(); } } public static void makeFrame(String inputName, XmlNode root) { JFrame frame = new JFrame("XppNodeTreeFrame"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} } ); JPanel treePanel = new JPanel(); EmptyBorder eb = new EmptyBorder(7,7,7,7); BevelBorder bb = new BevelBorder(BevelBorder.LOWERED); CompoundBorder cb = new CompoundBorder(eb,bb); treePanel.setBorder(new CompoundBorder(cb,eb)); JTree tree = new XppNodeTree(new XmlNodeToTreeModelAdapter(root)); JScrollPane treeView = new JScrollPane(tree); treeView.setPreferredSize( new Dimension( WIDTH, HEIGHT )); treePanel.setLayout(new BorderLayout()); treePanel.add("Center", treeView ); frame.getContentPane().add("Center", treePanel ); frame.pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int w = WIDTH + 10; int h = HEIGHT + 10; frame.setLocation(screenSize.width/3 - w/2, screenSize.height/2 - h/2); frame.setSize(w, h); frame.setVisible(true); frame.setTitle("XPP Node Tree - "+inputName); } public static void main(String args[]) { if (args.length < 1) { System.err.println( "Usage: java " +XppNodeTree.class.getName()+" filename"); System.exit(1); } try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME)); factory.setNamespaceAware(true); XmlPullParser pp = factory.newPullParser(); XmlNode root =factory.newNode(); try { // try to load XML assuming no mixed content // if it is the case then built tree is much nicer pp.setAllowedMixedContent(false); pp.setInput(new FileReader( args[0] )); pp.next(); // get first start tag pp.readNode(root); } catch(XmlPullParserException ex) { System.out.println("Trying again with mixed content "+ex); pp.setAllowedMixedContent(true); pp.setInput(new FileReader( args[0] )); pp.next(); // get first start tag pp.readNode(root); } //System.out.println(root); makeFrame(args[0], root); } catch (XmlPullParserException sxe) { Throwable t = sxe; if (sxe.getDetail() != null) t = sxe.getDetail(); t.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/samples/README.txt0000644000175000017500000000077007755336265020731 0ustar wbaerwbaer00000000000000Samples demonstrating how XPP2 can be used XppCount - counting XML elements also used for performance evaluations commandline - verion that works in J2SE+ environment midlet - verison for J2ME small devices shared - code shared in both verison - where actual parsing is done demonstrates how to abstract J2xx functionality to re-use it XppNodeTree - creating XML tree with XPP2 node APU and displaying it in GUI shows how to adpat XPP2 Node interface to work with SWIN tree PullParser2.1.10/src/java/tests/0000755000175000017500000000000010232453172016702 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/tests/format/0000755000175000017500000000000010232453172020172 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/tests/format/FormatTest.java0000644000175000017500000001277007755336260023152 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: FormatTest.java,v 1.4 2003/04/06 00:04:02 aslom Exp $ */ package format; import java.io.*; import java.util.Enumeration; import junit.framework.*; import org.gjt.xpp.*; /** * Some tests to implementation of XML Pull Parser 2 formatting/recording output API. * */ public class FormatTest extends TestCase { private int type; private XmlStartTag stag; private XmlEndTag etag; private XmlPullParserFactory factory; public FormatTest(String name) { super(name); } public static void main (String[] args) { junit.textui.TestRunner.run (suite()); System.exit(0); } public static Test suite() { return new TestSuite(FormatTest.class); } protected void setUp() throws XmlPullParserException { factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME) ); factory.setNamespaceAware(true); stag = factory.newStartTag(); etag = factory.newEndTag(); } protected void tearDown() { } public void testAttribFormat() throws IOException, XmlPullParserException { final String attribEntities = ""; XmlPullParser pp = factory.newPullParser(); parseOneElement(pp, attribEntities+"", false); pp.readStartTag(stag); //System.err.println("attr="+stag.getAttributeValue(0)); assertEquals("|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: LowLevelTest.java,v 1.7 2003/04/06 00:04:02 aslom Exp $ */ package lowlevel; import java.io.*; import java.util.Enumeration; import junit.framework.*; import org.gjt.xpp.*; /** * Some tests to implementation of XML Pull Parser (xpp). * */ public class LowLevelTest extends TestCase { private int type; private XmlStartTag stag; private XmlEndTag etag; private XmlPullParserFactory factory; private static final String HEADER_STR = "####"; private static final String TRAILER_STR = "%%%%%XXX"; private static final String XML_STR = HEADER_STR + "\n"+ "\n"+ "7\n"+ "aaaX"+ ""+ "\n"+ "\n"+ ""+ " \n"+ "\n"+ "\r\r\n\n\r\n\n\n "+ ""+ "\n"+ ""+ TRAILER_STR; public LowLevelTest(String name) { super(name); } public static void main (String[] args) { junit.textui.TestRunner.run (suite()); System.exit(0); } public static Test suite() { return new TestSuite(LowLevelTest.class); } protected void setUp() throws XmlPullParserException { factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME) ); factory.setNamespaceAware(true); stag = factory.newStartTag(); etag = factory.newEndTag(); } protected void tearDown() { } public void testSimple() throws IOException, XmlPullParserException { char[] buf = " World & Universe\n".toCharArray(); // -123456789-123456789-123456789-123456789-123456789 //System.err.println("factory: "+factory); XmlPullParser pp = factory.newPullParser(); pp.setInput(new CharArrayReader(buf)); if(pp instanceof XmlPullParserBufferControl) { XmlPullParserBufferControl ppbc = (XmlPullParserBufferControl) pp; assertEquals(ppbc.getBufferShrinkOffset(), 0); assertTrue(ppbc.isBufferShrinkable()); } assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("top", stag.getLocalName()); String uri = stag.getNamespaceUri(); assertEquals("", uri); XmlPullParserEventPosition ppev = null; if(pp instanceof XmlPullParserBufferControl) { ppev = (XmlPullParserEventPosition) pp; } int xmlStart = -1; int off = -1; String tag = null; if(ppev != null) { xmlStart = ppev.getEventStart(); off = 3; assertEquals(off, ppev.getEventStart()); off += 5; assertEquals(off, ppev.getEventEnd()); tag = new String(ppev.getEventBuffer(), xmlStart, ppev.getEventEnd() - xmlStart); assertEquals("", tag); } assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("hello", stag.getLocalName()); if(ppev != null) { assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); } assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("World & Universe", pp.readContent()); if(ppev != null) { xmlStart = ppev.getEventStart(); String content = new String(ppev.getEventBuffer(), xmlStart, ppev.getEventEnd() - xmlStart); assertEquals("World & Universe", content); assertEquals(off, ppev.getEventStart()); off += 20; assertEquals(off, ppev.getEventEnd()); } assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("hello", etag.getLocalName()); if(ppev != null) { xmlStart = ppev.getEventStart(); tag = new String(ppev.getEventBuffer(), xmlStart, ppev.getEventEnd() - xmlStart); assertEquals("", tag); assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); } assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("top", etag.getLocalName()); if(ppev != null) { xmlStart = ppev.getEventStart(); tag = new String(ppev.getEventBuffer(), xmlStart, ppev.getEventEnd() - xmlStart); assertEquals("", tag); assertEquals(off, ppev.getEventStart()); off += 6; assertEquals(off, ppev.getEventEnd()); } assertEquals(pp.next(), XmlPullParser.END_DOCUMENT); } public void testUnshrinkableLowLevel() throws IOException, XmlPullParserException { char[] buf = " World & Universe\n\n".toCharArray(); XmlPullParser pp = factory.newPullParser(); pp.setInput(new CharArrayReader(buf)); if(pp instanceof XmlPullParserBufferControl) { XmlPullParserBufferControl ppbc = (XmlPullParserBufferControl) pp; assertEquals(ppbc.getBufferShrinkOffset(), 0); assertTrue(ppbc.isBufferShrinkable()); // NOTE: this will gurantee that buffer will not be shrinked during parsing // however it may be still re-allocated so keeping pointer to it is useless... ppbc.setBufferShrinkable(false); assertEquals(ppbc.isBufferShrinkable(), false); } else { fail("buffer control is not supported in "+pp.getClass()); } assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("top", stag.getLocalName()); String uri = stag.getNamespaceUri(); assertEquals("", uri); XmlPullParserEventPosition ppev = null; if(pp instanceof XmlPullParserBufferControl) { ppev = (XmlPullParserEventPosition) pp; } else { fail("event positioning is not supported in "+pp.getClass()); } int xmlStart = ppev.getEventStart(); int off = 3; assertEquals(off, ppev.getEventStart()); off += 5; assertEquals(off, ppev.getEventEnd()); assertEquals("", new String(ppev.getEventBuffer(), ppev.getEventStart(), ppev.getEventEnd() - ppev.getEventStart())); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("hello", stag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("World & Universe", pp.readContent()); assertEquals(off, ppev.getEventStart()); off += 20; assertEquals(off, ppev.getEventEnd()); assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("hello", etag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("empty", stag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); // assertEquals(XmlPullParser.CONTENT, pp.next()); // assertEquals("", pp.readContent()); // off += 0; assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("empty", etag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 0; // zero as it is empty element... assertEquals(off, ppev.getEventEnd()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("empty", stag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 7; assertEquals(off, ppev.getEventEnd()); //assertEquals(XmlPullParser.CONTENT, pp.next()); //assertEquals("", pp.readContent()); //off += 0; assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("empty", etag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 8; assertEquals(off, ppev.getEventEnd()); assertEquals(XmlPullParser.END_TAG, pp.next()); pp.readEndTag(etag); assertEquals("top", etag.getLocalName()); assertEquals(off, ppev.getEventStart()); off += 6; assertEquals(off, ppev.getEventEnd()); int xmlEnd = ppev.getEventEnd(); assertEquals(buf.length - 13, xmlEnd); assertEquals(pp.next(), XmlPullParser.END_DOCUMENT); String orig = (new String(buf)).substring(3, off); //System.out.println("orig='"+orig+"'"); char[] xmlBuf = ppev.getEventBuffer(); String xml = (new String(xmlBuf)).substring(xmlStart, xmlEnd); assertEquals(orig, xml); //TODO set very small soft limit and check buffer shrinkig... } private String printable(char ch) { if(ch == '\n') { return "\\n"; } else if(ch == '\r') { return "\\r"; } else if(ch == '\t') { return "\\t"; } return ""+ch; } private String printable(String s) { int iN = s.indexOf('\n'); int iR = s.indexOf('\r'); int iT = s.indexOf('\t'); if((iN != -1) || (iR != -1) || (iT != -1)) { StringBuffer buf = new StringBuffer(); for(int i = 0; i < s.length(); ++i) { buf.append(printable(s.charAt(i))); } s = buf.toString(); } return s; } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/tests/node/0000755000175000017500000000000010232453172017627 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/tests/node/NodeTest.java0000644000175000017500000006060407755336260022243 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: NodeTest.java,v 1.5 2003/04/06 00:04:02 aslom Exp $ */ package node; import java.io.*; import java.util.Enumeration; import junit.framework.*; import org.gjt.xpp.*; /** * Some tests to implementation of XML Pull Parser (xpp). * */ public class NodeTest extends TestCase { private XmlPullParserFactory factory; private static final String HEADER_STR = "####"; private static final String TRAILER_STR = "%%%%%YYY"; private static final String XML_STR = HEADER_STR + "\n"+ "\n"+ " 7\n"+ " aaaX"+ " "+ " \n"+ " \n"+ " "+ " \n"+ " \n"+ //TODO DIXME when Xerces 2 is fixed //" \r\r\n\n\r\n\n\n "+ " "+ "\n"+ ""+ TRAILER_STR; public NodeTest(String name) { super(name); } public static void main (String[] args) { junit.textui.TestRunner.run (suite()); System.exit(0); } public static Test suite() { return new TestSuite(NodeTest.class); } protected void setUp() throws XmlPullParserException { factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME) ); factory.setNamespaceAware(true); } protected void tearDown() { } private final static String CHILD1_NAME = "hello"; private final static String CHILD1_CONTENT = "some <>& content"; private final static String CHILD1_ATTR1_NAME = "attr"; private final static String CHILD1_ATTR1_VALUE = "foo&bar"; private final static String CHILD2 = "Hello"; private final static String CHILD3_URI = "ssURI"; private final static String CHILD3_PREFIX = "x"; private final static String CHILD3_NAME = "helloNS"; private final static String CHILD3_ATTR1_NAME = "test"; private final static String CHILD3_ATTR1_VALUE = "lesshello"; XmlPullParser pp = factory.newPullParser(); pp.setNamespaceAware(true); pp.setInput(new StringReader(XML)); XmlNode node1 = factory.newNode(); pp.next(); pp.readNode(node1); pp.setInput(new StringReader(XML)); XmlNode node2 = factory.newNode(); pp.next(); pp.readNode(node2); assertEquals(node1.hashCode(), node2.hashCode()); assertEquals(node1, node2); XmlNode child = (XmlNode)node2.getChildAt(0); child.appendChild("something else"); assertTrue(node1.equals(node2) == false); } public void testPullNode() throws IOException, XmlPullParserException { // check working of tree node wit no mixed content final String NO_MIX_STR = "" +"" +"" +"Hello<" +"" +"Inner Tag!" +""; char[] buf = (""+NO_MIX_STR+"").toCharArray(); XmlPullParser pp = factory.newPullParser(); pp.setNamespaceAware(false); pp.setAllowedMixedContent(false); pp.setInput(new CharArrayReader(buf)); assertEquals(XmlPullParser.START_TAG, pp.next()); XmlPullNode node = factory.newPullNode(pp); XmlPullNode t1 = (XmlPullNode) node.readNextChild(); assertNotNull(t1); assertEquals("t1", t1.getLocalName()); assertEquals("", t1.getNamespaceUri()); assertEquals(null, t1.getDefaultNamespaceUri()); XmlPullNode child1 = (XmlPullNode) t1.readNextChild(); assertNotNull(child1); assertEquals(XmlPullParser.START_TAG, pp.getEventType()); XmlStartTag stag = factory.newStartTag(); pp.readStartTag(stag); assertEquals("child1", stag.getLocalName()); String uri = stag.getNamespaceUri(); assertEquals("", uri); XmlPullNode child2 = (XmlPullNode) t1.readNextChild(); XmlPullNode child3 = (XmlPullNode) t1.readNextChild(); assertEquals(XmlPullParser.START_TAG, pp.getEventType()); pp.readStartTag(stag); assertEquals("child3", stag.getLocalName()); child3.skipChildren(); XmlPullNode child4 = (XmlPullNode) t1.readNextChild(); XmlPullNode child5 = (XmlPullNode) t1.readNextChild(); assertNull(t1.readNextChild()); node.skipChildren(); assertEquals(XmlPullParser.END_TAG, pp.getEventType()); assertEquals(XmlPullParser.END_DOCUMENT, pp.next()); String outStr = checkNodeOutput(pp, node); // just to double check that pull node behave like regular node pp.setInput(new CharArrayReader(buf)); assertEquals(XmlPullParser.START_TAG, pp.next()); node = factory.newPullNode(pp); t1 = (XmlPullNode) node.getChildAt(0); child3 = (XmlPullNode) t1.getChildAt(2); // simulate skipChildren with readChildren and removing children... t1.readChildren(); assertTrue(child3.isFinished()); child3.removeChildren(); String outStr2 = checkNodeOutput(pp, node); assertEquals(outStr, outStr2); // check working of tree node with mixed content final String MIX_STR = "Hello! Hello<"; buf = (""+NO_MIX_STR+MIX_STR+"").toCharArray(); pp.setInput(buf); pp.setNamespaceAware(true); pp.setAllowedMixedContent(true); assertEquals(XmlPullParser.START_TAG, pp.next()); node = factory.newPullNode(pp); t1 = (XmlPullNode) node.getChildAt(0); //node.readNextChild(); assertTrue(! t1.isFinished()); assertEquals("t1", t1.getLocalName()); assertEquals("", t1.getNamespaceUri()); assertEquals("", t1.getDefaultNamespaceUri()); // check enumeration stuff... Enumeration enum = t1.children(); assertEquals(0, t1.getChildrenCountSoFar()); //child1, child2... assertTrue(enum.hasMoreElements()); child1 = (XmlPullNode) enum.nextElement(); assertEquals("child1", child1.getLocalName()); assertNotNull(enum.nextElement()); child3 = (XmlPullNode) enum.nextElement(); assertEquals("child3", child3.getLocalName()); assertNotNull(enum.nextElement()); assertEquals(4, t1.getChildrenCountSoFar()); assertEquals(true, enum.hasMoreElements()); assertNotNull(enum.nextElement()); assertEquals(false, enum.hasMoreElements()); XmlPullNode t2 = (XmlPullNode) node.getChildAt(1); assertEquals("t2", t2.getLocalName()); assertEquals("URI2", t2.getNamespaceUri()); assertEquals("URI2", t2.getDefaultNamespaceUri()); // System.err.println("t2 node="+t2); assertEquals(1, t2.getDeclaredNamespaceLength()); assertTrue(! t2.isFinished()); assertTrue(t1.isFinished()); assertEquals("Hello! ", t2.readNextChild()); XmlPullNode nsChild = (XmlPullNode) t2.readNextChild(); assertEquals("child", nsChild.getLocalName()); assertEquals("URI3", nsChild.getNamespaceUri()); assertEquals("URI2", nsChild.getDefaultNamespaceUri()); // just check namespace handling... assertEquals("URI3", nsChild.getQNameUri("ns:y")); assertEquals("X", nsChild.prefix2Namespace("x")); assertEquals("X", nsChild.getQNameUri("x:y")); assertEquals("URI2", nsChild.getQNameUri("")); assertEquals(null, t1.readNextChild()); outStr = checkNodeOutput(pp, node); // just to double check that pull node behave like regular node pp.setInput(new CharArrayReader(buf)); assertEquals(XmlPullParser.START_TAG, pp.next()); node = factory.newPullNode(pp); outStr2 = checkNodeOutput(pp, node); assertEquals(outStr, outStr2); // advanced: check that recursive pull/tree parsing is working pp.setInput(buf); assertEquals(XmlPullParser.START_TAG, pp.next()); node = factory.newPullNode(pp); t1 = (XmlPullNode) node.getChildAt(0); // get embedded pp to parse t1 children directly XmlPullParser epp = t1.getPullParser(); assertSame(pp, epp); // parse rest of t1 assertEquals(XmlPullParser.START_TAG, pp.next()); assertEquals("child1", pp.getLocalName()); pp.skipNode(); assertEquals(XmlPullParser.START_TAG, pp.next()); assertEquals("child2", pp.getLocalName()); pp.skipNode(); assertEquals(XmlPullParser.START_TAG, pp.next()); assertEquals("child3", pp.getLocalName()); pp.skipNode(); // and now: creating embedded pull node... assertEquals(XmlPullParser.START_TAG, pp.next()); child4 = factory.newPullNode(pp); assertEquals("child4", pp.getLocalName()); XmlPullNode inner1 = (XmlPullNode) child4.getChildAt(0); assertEquals(false, inner1.isFinished()); assertEquals(false, child4.isFinished()); inner1.skipChildren(); assertTrue(inner1.isFinished()); assertEquals(false, child4.isFinished()); child4.readChildren(); assertTrue(inner1.isFinished()); assertTrue(child4.isFinished()); // and back to pp assertEquals(XmlPullParser.START_TAG, pp.next()); assertEquals("child5", pp.getLocalName()); pp.skipNode(); assertEquals(XmlPullParser.END_TAG, pp.next()); // timing is important -- when embedding previous part MUST be parserd!!! t2 = (XmlPullNode) node.getChildAt(1); assertEquals("t2", t2.getLocalName()); t2.readChildren(); node.skipChildren(); assertEquals(XmlPullParser.END_TAG, pp.getEventType()); assertEquals(XmlPullParser.END_DOCUMENT, pp.next()); } public void testPullNodeWithXpp() throws IOException, XmlPullParserException { // check working of tree node wit no mixed content final String NO_MIX_STR = "" +"" +"" +"" +"Inner Tag!" +"" ; char[] buf = (""+NO_MIX_STR+"").toCharArray(); XmlPullParser pp = factory.newPullParser(); pp.setNamespaceAware(false); pp.setAllowedMixedContent(false); pp.setInput(new CharArrayReader(buf)); assertEquals(XmlPullParser.START_TAG, pp.next()); XmlPullNode top = factory.newPullNode(pp); XmlPullNode t1 = (XmlPullNode) top.readNextChild(); assertNotNull(t1); assertEquals("t1", t1.getLocalName()); assertEquals("", t1.getNamespaceUri()); assertEquals(null, t1.getDefaultNamespaceUri()); XmlPullNode child1 = (XmlPullNode) t1.readNextChild(); assertNotNull(child1); XmlStartTag stag = factory.newStartTag(); pp.readStartTag(stag); assertEquals("child1", stag.getLocalName()); String uri = stag.getNamespaceUri(); assertEquals("", uri); XmlPullParser embed = t1.getPullParser(); assertSame(pp, embed); // this is tricky part - we actually requested pp from parent node // it must make child1 finished and pp must be now on XmlEndTag etag = factory.newEndTag(); pp.readEndTag(etag); assertEquals("child1", etag.getLocalName()); assertTrue(child1.isFinished()); // now finish parsing child1 and parent can correctly continue while(true) { byte state = pp.next(); if(state == XmlPullParser.END_TAG) break; assertEquals(XmlPullParser.START_TAG, state); pp.skipNode(); } XmlPullNode t5 = (XmlPullNode) top.readNextChild(); assertEquals("t5", t5.getLocalName()); assertEquals("", t5.getNamespaceUri()); assertEquals(null, t5.getDefaultNamespaceUri()); XmlPullNode inner2 = (XmlPullNode) t5.readNextChild(); pp.readStartTag(stag); assertEquals("inner2", stag.getLocalName()); // the sam trick as before but here we call no readNext child on parent // but pull node is deep down just on inner2 child!!! XmlPullNode t6 = (XmlPullNode) top.readNextChild(); assertTrue(t5.isFinished()); assertEquals("t6", t6.getLocalName()); assertEquals("", t6.getNamespaceUri()); assertEquals(null, t6.getDefaultNamespaceUri()); assertEquals(false, t6.isFinished()); assertEquals(false, top.isFinished()); assertNull(top.readNextChild()); assertTrue(t6.isFinished()); assertTrue(top.isFinished()); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/tests/parser/0000755000175000017500000000000010232453172020176 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/tests/parser/ParserTest.java0000644000175000017500000006146707755336260023171 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: ParserTest.java,v 1.14 2003/04/06 00:04:02 aslom Exp $ */ package parser; import java.io.IOException; import java.io.StringReader; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.gjt.xpp.XmlEndTag; import org.gjt.xpp.XmlPullParser; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.XmlPullParserFactory; import org.gjt.xpp.XmlStartTag; /** * Some tests to implementation of XML Pull Parser (xpp). * */ public class ParserTest extends TestCase { private int type; private XmlStartTag stag; private XmlEndTag etag; private XmlPullParserFactory factory; private static final String HEADER_STR = "####"; private static final String TRAILER_STR = "%%%%%XXX"; private static final String XML_STR = HEADER_STR + "\n"+ "\n"+ "7\n"+ "aaaX"+ ""+ "\n"+ "\n"+ ""+ " \n"+ "\n"+ "\r\r\n\n\r\n\n\n "+ ""+ "\n"+ ""+ TRAILER_STR; public ParserTest(String name) { super(name); } public static void main (String[] args) { junit.textui.TestRunner.run (suite()); System.exit(0); } public static Test suite() { return new TestSuite(ParserTest.class); } protected void setUp() throws XmlPullParserException { factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME) ); factory.setNamespaceAware(true); stag = factory.newStartTag(); etag = factory.newEndTag(); } protected void tearDown() { } private void testSimple(XmlPullParser pp, boolean mixedContent) throws IOException, XmlPullParserException { assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("t1", stag.getLocalName()); assertEquals("t1", stag.getRawName()); if(mixedContent) { assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(printable("\n "), printable(pp.readContent())); } int countNs = pp.getNamespacesLength(pp.getDepth()); assertEquals(1, countNs); String[] namespaces = new String[countNs]; pp.readNamespacesUris(pp.getDepth(), namespaces, 0, countNs); assertEquals("test", namespaces[0]); String[] prefixes = new String[countNs]; pp.readNamespacesPrefixes(pp.getDepth(), prefixes, 0, countNs); assertEquals("ns", prefixes[0]); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("t2", stag.getLocalName()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("t2", etag.getLocalName()); if(mixedContent) { assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(" ", pp.readContent()); } assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("x2", stag.getLocalName()); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("Hello", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("x2", etag.getLocalName()); if(mixedContent) { assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(printable("\n"), printable(pp.readContent())); } assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("t1", etag.getLocalName()); countNs = pp.getNamespacesLength(pp.getDepth()); assertEquals(1, countNs); pp.readNamespacesUris(pp.getDepth(), namespaces, 0, countNs); assertEquals("test", namespaces[0]); pp.readNamespacesPrefixes(pp.getDepth(), prefixes, 0, countNs); assertEquals("ns", prefixes[0]); } public void testSimple() throws IOException, XmlPullParserException { final String SIMPLE_XML = "\n Hello\r\n"; XmlPullParser pp = factory.newPullParser(); pp.setInput(new StringReader(SIMPLE_XML)); testSimple(pp, true); // now repeat parsing but ignoring mixed content pp.setInput(new StringReader(SIMPLE_XML)); pp.setAllowedMixedContent(false); testSimple(pp, false); } public void testCDATA() throws IOException, XmlPullParserException { final String CDATA = ""; XmlPullParser pp = factory.newPullParser(); pp.setInput(new StringReader(CDATA)); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("F3", stag.getLocalName()); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("[Esc][Esc][Esc]", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("F3", etag.getLocalName()); } public void testXpp() throws IOException, XmlPullParserException { //if(Log.ON) l.log(Level.FINE, "starting test"); char[] buf = XML_STR.toCharArray(); XmlPullParser pp = factory.newPullParser(); pp.setInput(buf, HEADER_STR.length() , XML_STR.length() - HEADER_STR.length() - TRAILER_STR.length()); pp.setAllowedMixedContent(false); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("PlaceOrder", stag.getLocalName()); String uri = stag.getNamespaceUri(); assertEquals("Some-Namespace-URI", uri); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("DaysToDelivery", stag.getLocalName()); // check utility functions String local = pp.getQNameLocal("ns:alek"); assertEquals("alek", local); uri = pp.getQNameUri("ns:alek"); assertEquals(null, uri); uri = pp.getQNameUri("alek"); assertEquals("", uri); uri = pp.getQNameUri("m:alek"); assertEquals("Some-Namespace-URI", uri); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("7", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("DaysToDelivery", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("tree", stag.getLocalName()); pp.skipNode(); pp.readEndTag(etag); assertEquals("tree", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("empty", stag.getLocalName()); pp.skipNode(); pp.readEndTag(etag); assertEquals("empty", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("top", stag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("codebase", stag.getLocalName()); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(" ", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("codebase", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("codebase2", stag.getLocalName()); //assertEquals(XmlPullParser.CONTENT, pp.next()); //assertEquals("", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("codebase2", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("new-line", stag.getLocalName()); assertEquals(XmlPullParser.CONTENT, pp.next()); //assertEquals("", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("new-line", etag.getLocalName()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("top", etag.getLocalName()); assertEquals(XmlPullParser.END_TAG, pp.next());pp.readEndTag(etag); assertEquals("PlaceOrder", etag.getLocalName()); uri = etag.getNamespaceUri(); assertEquals("Some-Namespace-URI", uri); assertEquals(XmlPullParser.END_DOCUMENT, pp.next()); // make sure that if tried to read beyond that is excpetion ... } public void testAttribs() throws IOException, XmlPullParserException { final String XML_ATTRS = ""+ "my-event"+ ""+ ""; XmlPullParser pp = factory.newPullParser(); pp.setInput(new StringReader(XML_ATTRS)); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("event", stag.getLocalName()); assertEquals("event", stag.getRawName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("type", stag.getLocalName()); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals("my-event", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("type", etag.getLocalName()); assertEquals(XmlPullParser.START_TAG, pp.next());pp.readStartTag(stag); assertEquals("handback", stag.getLocalName()); //assertEquals(XmlPullParser.CONTENT, pp.next()); //assertEquals("", pp.readContent()); String xsiNull = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "null"); assertEquals("1", xsiNull); String xsiType = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "type"); assertEquals("ns2:string", xsiType); String typeName = pp.getQNameLocal(xsiType); assertEquals("string", typeName); String typeNS = pp.getQNameUri(xsiType); assertEquals("http://www.w3.org/1999/XMLSchema", typeNS); // check if removing works OK boolean removed = stag.removeAttributeByRawName("xsi:null"); assertTrue(removed); removed = stag.removeAttributeByName( "http://www.w3.org/1999/XMLSchema/instance", "null"); assertEquals(false, removed); removed = stag.removeAttributeByName( "http://www.w3.org/1999/XMLSchema/instance", "null"); assertEquals(false, removed); xsiNull = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "null"); assertEquals(null, xsiNull); xsiType = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "type"); assertEquals("ns2:string", xsiType); // remove second attribute as well removed = stag.removeAttributeByName( "http://www.w3.org/1999/XMLSchema/instance", "type"); assertTrue(removed); xsiNull = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "null"); assertEquals(null, xsiNull); xsiType = stag.getAttributeValueFromName( "http://www.w3.org/1999/XMLSchema/instance", "type"); assertEquals(null, xsiType); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("handback", etag.getLocalName()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("event", etag.getLocalName()); assertEquals(pp.next(), XmlPullParser.END_DOCUMENT); } public void testAttribUniq() throws IOException, XmlPullParserException { final String attribsOk = "\n"+ ""; final String duplicateAttribs = "\n"+ ""; final String duplicateNsAttribs = "\n"+ ""; final String duplicateXmlns = "\n"+ ""; final String duplicateAttribXmlnsDefault = "\n"+ ""; XmlPullParser pp = factory.newPullParser(); parseOneElement(pp, attribsOk, false); assertEquals("a", stag.getAttributeValueFromRawName("a")); assertEquals("b", stag.getAttributeValueFromRawName("b")); assertEquals("c", stag.getAttributeValueFromRawName("m:a")); assertEquals("d", stag.getAttributeValueFromRawName("n:b")); assertEquals("e", stag.getAttributeValueFromRawName("n:x")); parseOneElement(pp, attribsOk, true); assertEquals("a", stag.getAttributeValueFromRawName("a")); assertEquals("b", stag.getAttributeValueFromRawName("b")); assertEquals("c", stag.getAttributeValueFromRawName("m:a")); assertEquals("d", stag.getAttributeValueFromRawName("n:b")); assertEquals("e", stag.getAttributeValueFromRawName("n:x")); assertEquals("c", stag.getAttributeValueFromName("Some-Namespace-URI", "a")); assertEquals("d", stag.getAttributeValueFromName("Some-Namespace-URI", "b")); assertEquals("e", stag.getAttributeValueFromName("Some-Namespace-URI", "x")); assertEquals("a", stag.getAttributeValueFromName(null, "a")); assertEquals("b", stag.getAttributeValueFromName(null, "b")); parseOneElement(pp, duplicateNsAttribs, false); parseOneElement(pp, duplicateAttribXmlnsDefault, false); parseOneElement(pp, duplicateAttribXmlnsDefault, true); Exception ex; ex = null; try { parseOneElement(pp, duplicateAttribs, true); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); ex = null; try { parseOneElement(pp, duplicateAttribs, false); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); ex = null; try { parseOneElement(pp, duplicateXmlns, false); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); // disable this test for Xerces 2.0.1 or NullPointer Exception is thrown ... ex = null; try { parseOneElement(pp, duplicateXmlns, true); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); ex = null; try { parseOneElement(pp, duplicateNsAttribs, true); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); final String declaringEmptyNs = ""; // allowed when namespaces disabled parseOneElement(pp, declaringEmptyNs, false); // otherwise it is error to declare '' for non-default NS as described in // http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl ex = null; try { parseOneElement(pp, declaringEmptyNs, true); } catch(XmlPullParserException rex) { ex = rex; } assertNotNull(ex); } public void testNormalizeLine() throws IOException, XmlPullParserException { XmlPullParser pp = factory.newPullParser(); //----------------------- // ---- simple tests for end of line normalization final String simpleR = "-\n-\r-\r\n-\n\r-"; // element content EOL normalizaton final String tagSimpleR = ""+simpleR+""; final String expectedSimpleN = "-\n-\n-\n-\n\n-"; parseOneElement(pp, tagSimpleR, true); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(printable(expectedSimpleN), printable(pp.readContent())); // attribute content normalization final String attrSimpleR = ""; final String normalizedSimpleN = "- - - - -"; parseOneElement(pp, attrSimpleR, true); pp.readStartTag(stag); String attrVal = stag.getAttributeValueFromRawName("a"); //TODO Xerces2 assertEquals(printable(normalizedSimpleN), printable(attrVal)); //----------------------- // --- more complex example with more line engins together final String firstR = "\r \r\n \n\r \n\n \r\n\r \r\r \r\n\n \n\r\r\n\r"+ ""; // element content final String tagR = ""+ firstR+ "\r\n"; final String expectedN = "\n \n \n\n \n\n \n\n \n\n \n\n \n\n\n\n"; parseOneElement(pp, tagR, true); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(printable(expectedN), printable(pp.readContent())); // attribute value final String attrR = ""; final String normalizedN = " "; parseOneElement(pp, attrR, true); pp.readStartTag(stag); attrVal = stag.getAttributeValueFromRawName("fifi"); //System.err.println("attrNormalized.len="+normalizedN.length()); //System.err.println("attrVal.len="+attrVal.length()); //TODO Xerces2 assertEquals(printable(normalizedN), printable(attrVal)); //----------------------- // --- even more complex final String manyLineBreaks = "fifi\r&\r&\r\n foo &\r bar \n\r\n""+ firstR; final String manyTag = ""+ manyLineBreaks+ "\r\n"; final String manyExpected = "fifi\n&\n&\n foo &\n bar \n\n\""+ expectedN; //"\r \r\n \n\r \n\n \r\n\r \r\r \r\n\n \n\r\r\n\r"; parseOneElement(pp, manyTag, true); assertEquals(XmlPullParser.CONTENT, pp.next()); assertEquals(manyExpected, pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_TAG); pp.readEndTag(etag); assertEquals("test", etag.getLocalName()); // having \r\n as last characters is the hardest case //assertEquals(XmlPullParser.CONTENT, pp.next()); //assertEquals("\n", pp.readContent()); assertEquals(pp.next(), XmlPullParser.END_DOCUMENT); final String manyAttr = ""; final String manyNormalized = "fifi & & foo & bar \""+ normalizedN; parseOneElement(pp, manyAttr, true); pp.readStartTag(stag); attrVal = stag.getAttributeValueFromRawName("fifi"); //TODO Xerces2 assertEquals(printable(manyNormalized), printable(attrVal)); } private void parseOneElement( final XmlPullParser pp, final String buf, final boolean supportNamespaces) throws IOException, XmlPullParserException { //pp.setInput(buf.toCharArray()); pp.setInput(new StringReader(buf)); pp.setNamespaceAware(supportNamespaces); pp.setAllowedMixedContent(false); pp.next(); pp.readStartTag(stag); if(supportNamespaces) { assertEquals("test", stag.getLocalName()); } else { assertEquals("m:test", stag.getLocalName()); } } private static String printable(char ch) { if(ch == '\n') { return "\\n"; } else if(ch == '\r') { return "\\r"; } else if(ch == '\t') { return "\\t"; } return ""+ch; } private static String printable(String s) { int iN = s.indexOf('\n'); int iR = s.indexOf('\r'); int iT = s.indexOf('\t'); if((iN != -1) || (iR != -1) || (iT != -1)) { StringBuffer buf = new StringBuffer(); for(int i = 0; i < s.length(); ++i) { buf.append(printable(s.charAt(i))); } s = buf.toString(); } return s; } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/tests/AllTests.java0000644000175000017500000001367607755336260021333 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: AllTests.java,v 1.7 2003/04/06 00:04:02 aslom Exp $ */ import junit.framework.*; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.XmlPullParserFactory; /** * TestSuite that runs all the sample tests * * @version $Revision: 1.7 $ * @author Aleksander A. Slominski mailto:aslom@extreme.indiana.edu */ public class AllTests { public static void main (String[] args) { String[] factories = new String[] { null, "org.gjt.xpp.impl.PullParserFactoryFullImpl", "org.gjt.xpp.x2impl.X2PullParserFactoryImpl", }; for(int i = 0; i < factories.length; ++i) { String fctry = factories[i]; String systemDefFctry = System.getProperty( org.gjt.xpp.XmlPullParserFactory.DEFAULT_PROPERTY_NAME); Class fctryClass = null; if(fctry != null) { System.setProperty( org.gjt.xpp.XmlPullParserFactory.DEFAULT_PROPERTY_NAME, fctry); } try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance( System.getProperty(XmlPullParserFactory.DEFAULT_PROPERTY_NAME) ); fctryClass = factory.getClass(); } catch(XmlPullParserException ex) { if(fctry != null) { System.out.println("cannot run test for XPP2 factory: "+fctry); } else { System.out.println("cannot test for default XPP2 factory"); } ex.printStackTrace(System.out); continue; } if(fctry != null) { System.out.println("running test for factory: "+fctry+"\nfound "+fctryClass); } else { System.out.println("running test for default factory\nfound "+fctryClass); } junit.textui.TestRunner.run (suite()); if(fctry != null) { if(systemDefFctry != null) { System.setProperty( org.gjt.xpp.XmlPullParserFactory.DEFAULT_PROPERTY_NAME, systemDefFctry); } else { // null can not be put on Hashtable or NullPointerException // --- dirty hack to restore previous value... System.getProperties().remove( org.gjt.xpp.XmlPullParserFactory.DEFAULT_PROPERTY_NAME); } } } System.exit(0); } public static Test suite ( ) { TestSuite suite= new TestSuite("All JUnit Tests for XPP2"); suite.addTest(parser.ParserTest.suite()); suite.addTest(format.FormatTest.suite()); suite.addTest(node.NodeTest.suite()); suite.addTest(lowlevel.LowLevelTest.suite()); /* //*/ return suite; } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/tests/README.txt0000644000175000017500000000015607755336266020426 0ustar wbaerwbaer00000000000000JUnit tests designed to ease code refactoring and new features adding so old features will not be broken :-) PullParser2.1.10/src/java/tests/SmallTests.java0000644000175000017500000000725107755336260021663 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: SmallTests.java,v 1.4 2003/04/06 00:04:02 aslom Exp $ */ import junit.framework.*; /** * Test to run for subset of XPP2 API that only has XmlPullParser * * @version $Revision: 1.4 $ * @author Aleksander A. Slominski mailto:aslom@extreme.indiana.edu */ public class SmallTests { public static void main (String[] args) { junit.textui.TestRunner.run (suite()); System.exit(0); } public static Test suite ( ) { TestSuite suite= new TestSuite("Small JUnit Tests for XPP2"); suite.addTest(parser.ParserTest.suite()); //suite.addTest(lowlevel.LowLevelTest.suite()); return suite; } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/x2/0000755000175000017500000000000010232453172016071 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/0000755000175000017500000000000007755336257017564 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/META-INF/0000755000175000017500000000000007755336257020724 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/META-INF/services/0000755000175000017500000000000010232453172022523 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/META-INF/services/org.gjt.xpp.XmlPullParserFactory0000644000175000017500000000005207755336257030750 0ustar wbaerwbaer00000000000000org.gjt.xpp.x2impl.X2PullParserFactoryImplPullParser2.1.10/src/java/x2/factory/org/0000755000175000017500000000000007755336257020353 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/org/gjt/0000755000175000017500000000000007755336257021137 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/org/gjt/xpp/0000755000175000017500000000000007755336257021746 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/org/gjt/xpp/x2impl/0000755000175000017500000000000010232453172023135 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/factory/org/gjt/xpp/x2impl/X2PullParserFactoryImpl.java0000644000175000017500000001044507755336257030505 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: X2PullParserFactoryImpl.java,v 1.3 2003/04/06 00:04:03 aslom Exp $ */ package org.gjt.xpp.x2impl; import org.gjt.xpp.*; import org.gjt.xpp.impl.format.Formatter; import org.gjt.xpp.impl.format.Recorder; import org.gjt.xpp.impl.node.Node; import org.gjt.xpp.impl.pullnode.PullNode; import org.gjt.xpp.x2impl.x2pullparser.X2PullParser; import org.gjt.xpp.impl.tag.EndTag; import org.gjt.xpp.impl.tag.StartTag; /** * Implementation of Pull Parser Factory. * * @author Aleksande Slominski */ public class X2PullParserFactoryImpl extends XmlPullParserFactory { public XmlPullParser newPullParser() throws XmlPullParserException { XmlPullParser pp = new X2PullParser(); pp.setNamespaceAware(isNamespaceAware()); return pp; } public XmlEndTag newEndTag() { return new EndTag(); } public XmlNode newNode() { return new Node(); } public XmlPullNode newPullNode(XmlPullParser pp) throws XmlPullParserException { return new PullNode(pp); } public XmlStartTag newStartTag() { return new StartTag(); } public XmlFormatter newFormatter() throws XmlPullParserException { return new Formatter(); } public XmlRecorder newRecorder() { return new Recorder(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/x2/pullparser/0000755000175000017500000000000007755336257020306 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/0000755000175000017500000000000007755336257021075 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/0000755000175000017500000000000007755336257021661 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/0000755000175000017500000000000007755336257022470 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/0000755000175000017500000000000007755336257023703 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/0000755000175000017500000000000010232453172026322 5ustar wbaerwbaer00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/X2Attribute.java0000644000175000017500000000757707755336257031406 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: X2Attribute.java,v 1.4 2003/04/06 00:04:03 aslom Exp $ */ package org.gjt.xpp.x2impl.x2pullparser; /** * used only internally by XPP * * * @author Aleksander Slominski */ public class X2Attribute { public String uri; public String localName; public String qName; public String value; public String prefix; /** when true indicates that attribute is xmlns* related */ public boolean xmlnsAttrib; public X2Attribute() { } public String toString() { StringBuffer buf = new StringBuffer(" "); buf.append("'"+qName+"'"); if(uri != null && !uri.equals("")) { buf.append("('"+uri+"','"+localName+"')"); } buf.append("='"); if(xmlnsAttrib) buf.append("[namespace]"); buf.append(value); buf.append("'"); return buf.toString(); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/X2ElementContent.java0000644000175000017500000001223607755336257032353 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: X2ElementContent.java,v 1.3 2003/04/06 00:04:03 aslom Exp $ */ package org.gjt.xpp.x2impl.x2pullparser; import org.gjt.xpp.XmlNode; /** * Utility class to keep information about XML element such as name etc. * and if namespaces enabled also list of declared prefixes and * previous values of prefixes namespace uri * (to restore them in ns hashtbale) */ public class X2ElementContent { private final static boolean TRACE_SIZING = false; String qName; //char qNameBuf[]; String uri; String localName; String prefix; String defaultNs; int prefixesEnd; int prefixesSize; String[] prefixes; String[] namespaceURIs; String[] prefixPrevNs; // just to optimize readNode XmlNode node; X2ElementContent() { } public String toString() { StringBuffer sb = new StringBuffer(); String name = getClass().getName(); int lastDot = name.lastIndexOf('.'); if(lastDot != -1) name = name.substring(lastDot + 1); sb.append(name); sb.append("{"); sb.append(qName+"("+prefix+" "+uri+":"+localName+")"); for (int i = 0; i < prefixesEnd; i++) { sb.append("["+prefixes[i]+"="+namespaceURIs[i] +" <-- "+prefixPrevNs[i]+"]"); } sb.append("}"); return sb.toString(); } void ensureCapacity(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 if(prefixesSize < newSize) { if(TRACE_SIZING) { System.err.println("prefixesEnd "+prefixesEnd+" ==> "+newSize); } String[] newPrefixes = new String[newSize]; String[] newNamespaceURIs = new String[newSize]; String[] newPrefixPrevNs = new String[newSize]; if(prefixes != null) { System.arraycopy( prefixes, 0, newPrefixes, 0, prefixesEnd); System.arraycopy( namespaceURIs, 0, newNamespaceURIs, 0, prefixesEnd); System.arraycopy( prefixPrevNs, 0, newPrefixPrevNs, 0, prefixesEnd); } prefixes = newPrefixes; namespaceURIs = newNamespaceURIs; prefixPrevNs = newPrefixPrevNs; prefixesSize = newSize; } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/X2PullParser.java0000644000175000017500000016406707755336257031532 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: X2PullParser.java,v 1.14 2003/04/06 00:04:03 aslom Exp $ */ package org.gjt.xpp.x2impl.x2pullparser; import java.io.CharArrayReader; import java.io.IOException; import java.io.Reader; import java.util.Hashtable; import org.apache.xerces.parsers.StandardParserConfiguration; import org.apache.xerces.xni.Augmentations; import org.apache.xerces.xni.NamespaceContext; import org.apache.xerces.xni.QName; import org.apache.xerces.xni.XMLAttributes; import org.apache.xerces.xni.XMLDocumentHandler; import org.apache.xerces.xni.XMLLocator; import org.apache.xerces.xni.XMLResourceIdentifier; import org.apache.xerces.xni.XMLString; import org.apache.xerces.xni.XNIException; import org.apache.xerces.xni.parser.XMLDocumentSource; import org.apache.xerces.xni.parser.XMLErrorHandler; import org.apache.xerces.xni.parser.XMLInputSource; import org.apache.xerces.xni.parser.XMLParseException; import org.apache.xerces.xni.parser.XMLPullParserConfiguration; import org.gjt.xpp.XmlEndTag; import org.gjt.xpp.XmlNode; import org.gjt.xpp.XmlPullParser; import org.gjt.xpp.XmlPullParserBufferControl; import org.gjt.xpp.XmlPullParserEventPosition; import org.gjt.xpp.XmlPullParserException; import org.gjt.xpp.XmlStartTag; // TODO: more efficient text normalization (see how xercerce SAX2...) // TODO: allow to disable mixed content // TODO: investingate how to retrieve event location in input stream /** * This is Xerces 2 driver that uses XNI pull parsing capabilities to * implement XML Pull Parser API. * * Advantages:

      *
    • uses Xerces 2 and bases in stable and standard compliant parser *
    • uses Xerces 2 XNI in pull parser mode but hides complexity * of working with XNI with simple PullParser API *
    * * Limitations:
      *
    • this is alpha version - may have still bugs :-) *
    * * @author Aleksander Slominski */ public class X2PullParser //extends XMLDocumentParser implements XmlPullParser, XmlPullParserEventPosition, XmlPullParserBufferControl, XMLErrorHandler, XMLDocumentHandler { private final static boolean DEBUG = false; private final static boolean PRINT_ERROR = false; private final static boolean TRACE_SIZING = false; // --- to access Xerces 2 resources protected static final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces"; protected static final String NAMESPACE_PREFIXES_FEATURE_ID = "http://xml.org/sax/features/namespace-prefixes"; protected XMLPullParserConfiguration pullParserConfiguration; //protected XMLParserConfiguration pullParserConfiguration; protected XMLLocator locator; // reused when parising as value container protected QName attrQName = new QName(); // used handling problem of not evaluating setFeature after setInputSource // --> deferring setInputSource as long as possible!!! protected boolean needToSetInput; protected CumulativeReader cumulativeReader; protected XMLInputSource inputSource; protected boolean shrinkable = true; // --- parser parameters /** Have we read empty element? */ protected boolean emptyElement; ///** just to make that empty element content must be emitted */ //protected boolean emptyElementContent; // mapping namespace prefixes to uri /** should parser support namespaces? */ protected boolean supportNs; /** should parser report namespace xmlns* attributes ? */ protected boolean reportNsAttribs; // handling mixed content protected boolean allowedMixedContent = true; //------------------------------------------------------ // --- parser state protected Exception seenException; protected boolean disableOffsetTracking; protected int contentEventStart; protected int contentEventEnd; /** start position of current event in tokenizer biffer */ protected int eventStart; /** end position of current event in tokenizer biffer */ protected int eventEnd; /** Have we seen root element */ protected boolean seenRootElement; /** Content of current element if in CONTENT state */ //protected String elContent; protected StringBuffer contentBuf = new StringBuffer(); /** what is current event type as returned from next()? */ protected byte state; /** mapping of names prefixes to uris */ protected Hashtable prefix2Ns = new Hashtable(); /** index for last attribute in attrPos array */ protected int attrPosEnd; /** size of attrPos array */ protected int attrPosSize; /** temporary array of current attributes */ protected X2Attribute attrPos[]; // for validating element pairing and string namespace context /** how many elements are on elStack */ protected int elStackDepth; /** size of elStack array */ protected int elStackSize; /** temprary array to keep ElementContent stack */ protected X2ElementContent[] elStack; // not used as chnaging state != -1 means that callback was called - see next() //protected boolean xniCallbackCalled = false; protected boolean startTagInitialized = false; protected boolean seenContent = false; protected boolean gotContent = false; protected boolean nonWhitespaceContent = false; protected boolean seenCR = false; protected boolean mixInElement = false; protected byte nextState; /** * Create instance of pull parser. */ public X2PullParser() throws XmlPullParserException { //super(new StandardParserConfiguration()); // hacking to overcome constrctor initialization ... //pullParserConfiguration = (StandardParserConfiguration) fConfiguration; pullParserConfiguration = new StandardParserConfiguration(); pullParserConfiguration.setDocumentHandler(this); pullParserConfiguration.setErrorHandler(this); pullParserConfiguration.setFeature( "http://apache.org/xml/features/continue-after-fatal-error", true); //DocumentTracer tracer = // new DocumentTracer(pullParserConfiguration); setNamespaceAware(false); } // -- privae debug methods private static void debug(String msg) { debug(msg, null); } private static void debug(String msg, Exception ex) { if(!DEBUG) { throw new RuntimeException( "only when DEBUG enabled can print messages"); } System.err.println("X2PP: "+msg+(ex != null ? " "+ex.getMessage() : "") ); if(ex != null) ex.printStackTrace(); } private static void error(String msg, Exception ex) { if(!DEBUG && !PRINT_ERROR) { throw new RuntimeException( "only when DEBUG or REPORT_ERROR enabled can print messages"); } System.err.println("X2PP ERROR: "+msg+(ex != null ? " "+ex.getMessage() : "") ); if(ex != null) ex.printStackTrace(); } // // --- XMLErrorHandler methods /** Warning. */ public void warning(String domain, String key, XMLParseException ex) throws XNIException { if(PRINT_ERROR || DEBUG) error("XMLErrorHandler warning()", ex); } /** Error. */ public void error(String domain, String key, XMLParseException ex) throws XNIException { if(PRINT_ERROR || DEBUG) error("XMLErrorHandler error()", ex); } // error(String,String,XMLParseException) /** Fatal error. */ public void fatalError(String domain, String key, XMLParseException ex) throws XNIException { if(PRINT_ERROR || DEBUG) error("XMLErrorHandler fatalError()", ex); //throw ex; seenException = ex; } // fatalError(String,String,XMLParseException) // // --- XMLDocumentHandler methods // /** Document source*/ protected XMLDocumentSource fDocumentSource; /** Sets the document source */ public void setDocumentSource(XMLDocumentSource source){ fDocumentSource = source; } // setDocumentSource /** Returns the document source */ public XMLDocumentSource getDocumentSource (){ return fDocumentSource; } // getDocumentSource public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException { //TODO: check if we *can* safely ignore namespaceContext ??? startDocument(locator, encoding, augs); } public void startDocument(XMLLocator locator, String encoding, Augmentations augs) throws XNIException { this.locator = locator; if(DEBUG) debug("startDocument locator="+locator); seenRootElement = false; startTagInitialized = false; seenContent = false; nonWhitespaceContent = false; } public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException {} public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException {} public void comment(XMLString text, Augmentations augs) throws XNIException {} public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException {} public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException { } // startGeneralEntity(String,XMLResourceIdentifier,String,Augmentations) public void endGeneralEntity(String name, Augmentations augs) throws XNIException { } // endGeneralEntity(String,Augmentations) private void initializeStartTag() { ensureCapacity(elStackDepth + 1); X2ElementContent el = elStack[elStackDepth]; el.prefixesEnd = 0; el.defaultNs = null; attrPosEnd = 0; state = START_TAG; //contentBuf.setLength(0); startTagInitialized = true; //seenContent = false; gotContent = false; } public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException { if(state != -1 && state != START_TAG) throw new XNIException("unexcpected state="+state); if(!startTagInitialized) { initializeStartTag(); } X2ElementContent el = elStack[elStackDepth]; //if(attrPosEnd >= attrPosSize) ensureAttribs(attrPosEnd + 1); //X2Attribute ap = attrPos[attrPosEnd]; //TODO check me if(prefix == null || "".equals(prefix)) { if(el.defaultNs != null) { throw new XNIException( "default namespace was alredy declared by xmlns attribute"); } if(DEBUG) debug("adding default uri="+uri); el.defaultNs = uri; // if(reportNsAttribs) { // ap.xmlnsAttrib = true; // ++attrPosEnd; // } } else { if(el.prefixesEnd >= el.prefixesSize) { el.ensureCapacity(el.prefixesEnd); } el.prefixes[el.prefixesEnd] = prefix; el.namespaceURIs[el.prefixesEnd] = uri; el.prefixPrevNs[el.prefixesEnd] = (String) prefix2Ns.get(prefix); ++el.prefixesEnd; if(DEBUG) debug("adding prefix="+prefix+" uri="+uri); prefix2Ns.put(prefix, uri); // if(reportNsAttribs) { // ap.xmlnsAttrib = true; // ++attrPosEnd; // } } } public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if(state != -1 && state != START_TAG) { throw new XNIException("unexcpected state="+state); } //xniCallbackCalled = true; if(!startTagInitialized) { initializeStartTag(); emptyElement = false; } startTagInitialized = false; if(allowedMixedContent == false && nonWhitespaceContent) { throw new XNIException( "mixed content is not allowed (content='"+escape(contentBuf.toString())+"'" +" mixed with element "+element+")"); } nonWhitespaceContent = false; mixInElement = true; extractEventPosition(augs); // if(element instanceof PositionedQName) { // PositionedQName pqname = (PositionedQName) element; // eventStart = pqname.posAbsoluteStart; // eventEnd = pqname.posAbsoluteEnd; // } X2ElementContent el = elStack[elStackDepth]; //eventStart = tokenizer.posStart - 1; if(elStackDepth >= elStackSize) { ensureCapacity(elStackDepth); } el.qName = element.rawname; if(supportNs) { el.localName = element.localpart; el.prefix = element.prefix; el.uri = element.uri; } else { el.localName = el.qName; el.prefix = null; el.uri = null; //TODO is it correct for non namespaced? } //++elStackDepth; // process all attributes int length = attributes.getLength(); for (int i = 0; i < length; i++) { attributes.getName(i, attrQName); //TODO better how xmlns and xmlns: attribs are handled? boolean xmlnsAttrib = false; if(supportNs) { xmlnsAttrib = ("xmlns".equals(attrQName.rawname) || attrQName.rawname.startsWith("xmlns:")); if(xmlnsAttrib && reportNsAttribs == false) { continue; // skip NS attrib } } if(attrPosEnd >= attrPosSize) ensureAttribs(attrPosEnd + 1); X2Attribute ap = attrPos[attrPosEnd]; ap.qName = attrQName.rawname; ap.xmlnsAttrib = xmlnsAttrib; ap.prefix = attrQName.prefix; ap.localName = attrQName.localpart; ap.uri = attrQName.uri; //String attrType = attributes.getType(i); ap.value = attributes.getValue(i); ++attrPosEnd; } if(el.defaultNs == null) { if(elStackDepth > 0) { el.defaultNs = elStack[elStackDepth - 1].defaultNs; } else { el.defaultNs = ""; } } //el.defaultNs = element.uri; if(DEBUG) debug("startTag() adding element el="+el+getPosDesc()); //throw new XNIException("test"); } public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if(DEBUG) debug("emptyElement() called for "+element); // state may be already START_TAG when startPrefixMapping was called before... if(state != -1 && state != START_TAG) { throw new XNIException("unexpected state="+state); } startElement(element, attributes, augs); emptyElement = true; if(DEBUG) debug("emptyElement() exit for "+element); //endElement(element); } public void startEntity(String name, String publicId, String systemId, String baseSystemId, String encoding, Augmentations augs) throws XNIException {} public void textDecl(String version, String encoding, Augmentations augs) throws XNIException {} public void endEntity(String name, Augmentations augs) throws XNIException {} private void addNormalizedContent(XMLString text) { for (int i = text.offset; i < text.offset + text.length; i++) { char c = text.ch[i]; if(c == '\r') { seenCR = true; contentBuf.append('\n'); } else if(c == '\n') { if(seenCR == false) { contentBuf.append('\n'); } seenCR = false; } else if(c == '\t' || c == ' ') { seenCR = false; contentBuf.append(c); } else { // S as define by [3] in http://www.w3.org/TR/2000/REC-xml-20001006#NT-S nonWhitespaceContent = true; seenCR = false; contentBuf.append(c); } } //contentBuf.append(text.ch, text.offset, text.length); } private static String state(byte state) { if(state == END_DOCUMENT) { return "END_DOCUMENT"; } else if(state == END_TAG) { return "END_TAG"; } else if(state == START_TAG) { return "START_TAG"; } else if(state == CONTENT) { return "CONTENT"; } else { return "UNKNONW_EVENT ("+state+")"; } } private static String escape(String s) { StringBuffer buf = new StringBuffer(s.length()); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if(c == '\n') { buf.append("\\n"); } else if(c == '\r') { buf.append("\\r"); } else if(c == '\t') { buf.append("\\t"); } else if(c == '\\') { buf.append("\\"); } else if(c == '"') { buf.append('"'); } else if(c < 32) { buf.append("\\x"+Integer.toHexString(c)); } else { buf.append(c); } } return buf.toString(); } //private Object[] noParams = new Object[0]; private int getCurrentEntityAbsoluteOffset() { int pos = -1; if(locator != null && ! disableOffsetTracking ) { try { // use reflection to invoke: // pos = locator.getCurrentEntityAbsoluteOffset(); Class klass = locator.getClass(); java.lang.reflect.Method m = klass.getMethod("getCurrentEntityAbsoluteOffset", null); Integer i = (Integer) m.invoke(locator, null); pos = i.intValue(); } catch (Exception e) { disableOffsetTracking = true; if(DEBUG) debug("disabled offset tracking", e); } } return pos; } public void characters(XMLString text, Augmentations augs) throws XNIException { if(state != -1) {// && state != CONTENT) throw new XNIException("unexpected state="+state); } //xniCallbackCalled = true; //state = CONTENT; if(DEBUG) debug("content='"+escape(new String(text.ch, text.offset, text.length)+"'")); seenContent = true; gotContent = false; addNormalizedContent(text); contentEventEnd = getCurrentEntityAbsoluteOffset(); if(DEBUG) debug("added content '"+escape(text.toString())+"'"); } public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException { characters(text, augs); // if(state != -1) // && state != CONTENT) // throw new XNIException("unexpected state="+state); // //state = CONTENT; // seenContent = true; // addNormalizedContent(text); // if(DEBUG) debug("added whitespace '"+escape(text.toString())+"'"); } private void endElement() { if(elStackDepth < 1) { // should never happen... throw new XNIException( "end tag without start stag"); } if(allowedMixedContent == false && !mixInElement) { // seen end tag before; if(seenContent && nonWhitespaceContent) { throw new XNIException( "mixed content is not allowed (content='"+escape(contentBuf.toString())+"'" +" before end tag unles it is element content"); } } if(seenContent) { gotContent = true; } X2ElementContent el = elStack[elStackDepth-1]; if(DEBUG) debug("end element el="+el); // restore declared namespaces if(supportNs && el.prefixes != null) { //NOTE: it is in REVERSE order! for(int i = el.prefixesEnd - 1; i >= 0; --i) { //System.err.println("el="+el); if( el.prefixPrevNs[i] != null) { prefix2Ns.put( el.prefixes[i], el.prefixPrevNs[i] ); } else { prefix2Ns.remove( el.prefixes[i] ); } } // el.prefixesEnd = 0; // this would prevent readNamesapces* from working } } // Augmentations item names that can be used in patched Xerces2 to retrieve // position of event for start and end tag public final String POS_ABSOLUTE_START = "http://gjt.org/xpp/pos-absolute-start"; //ALEK public final String POS_ABSOLUTE_END = "http://gjt.org/xpp/pos-absolute-end"; //ALEK public void endElement(QName element, Augmentations augs) throws XNIException { if(state != -1) throw new XNIException("unexcpected state="+state); //xniCallbackCalled = true; state = END_TAG; extractEventPosition(augs); endElement(); } private void extractEventPosition(Augmentations augs) { // if(element instanceof PositionedQName) { // PositionedQName pqname = (PositionedQName) element; // eventStart = pqname.posAbsoluteStart; // eventEnd = pqname.posAbsoluteEnd; // } if(augs != null && augs.getItem(POS_ABSOLUTE_START) != null) { eventStart = ((Integer)augs.getItem(POS_ABSOLUTE_START)).intValue(); eventEnd = ((Integer)augs.getItem(POS_ABSOLUTE_END)).intValue(); } } public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException { // useless as does not contain previous uri to be restored ... } public void startCDATA(Augmentations augs) throws XNIException {} public void endCDATA(Augmentations augs) throws XNIException {} public void endDocument(Augmentations augs) throws XNIException { if(state != -1) throw new XNIException("unexcpected state="+state); //xniCallbackCalled = true; state = END_DOCUMENT; if(elStackDepth > 0) { throw new XNIException( "expected element end tag '" +elStack[elStackDepth-1].qName+"' not end of document" ); } } // endDocument() private static int step; // -- key method /** * This is a key method - translates XNI callbacks * into XPP events * (such as START_TAG, END_TAG, CONTENT). * or END_DOCUMENT if no more input. * */ public byte next() throws XmlPullParserException, IOException { if(inputSource == null) { throw new XmlPullParserException( "setInput must be called before can start parsing"); } if(needToSetInput) { needToSetInput = false; try { pullParserConfiguration.setInputSource(inputSource); } catch(IOException ex) { throw new XmlPullParserException( "could not set input to reader", ex); } } if(state == CONTENT && seenContent && nextState != -1) { //seenContent = false; //assert previousState != CONTENT state = nextState; nextState = -1; gotContent = false; //contentBuf.setLength(0); if(DEBUG) debug("# END returned already CONTENT and now returning state="+state(state)); } else if(emptyElement) { emptyElement = false; state = END_TAG; eventStart = eventEnd; nextState = -1; if(DEBUG) debug("# END empty element state="+state+" nextState="+state(nextState)); endElement(); gotContent = false; } else { // nothing available - pull some input from Xerces 2 ... try { nextState = state = -1; contentBuf.setLength(0); seenContent = false; seenCR = false; nonWhitespaceContent = false; eventStart = eventEnd = -1; contentEventStart = getCurrentEntityAbsoluteOffset(); seenException = null; while(seenException == null) { if(DEBUG) debug("# step["+(++step)+"]"); while(state == -1) { if(pullParserConfiguration.parse(false) == false) { // parsing now finished but may still be some state left... if(state == -1) { state = END_DOCUMENT; } } } //eventEnd = locator.getCurrentEntityAbsoluteOffset(); if(state != -1) { if(seenContent) { // skip whitespace content when no mixed content allowed if(!allowedMixedContent) { if(DEBUG) debug("# END skip state="+state(state) +" mixInElement="+mixInElement +" nonWhitespaceContent="+nonWhitespaceContent); if(state == END_TAG && !mixInElement && !nonWhitespaceContent) { if(DEBUG) debug("# END skip='"+escape(contentBuf.toString())+"'"); break; // skip content } else if(state == START_TAG && !nonWhitespaceContent) { if(DEBUG) debug("# END skip='"+escape(contentBuf.toString())+"'"); break; // skip content } } nextState = state; state = CONTENT; } break; } } } catch(XNIException ex) { seenException = ex; } } if(state == END_TAG) { --elStackDepth; mixInElement = false; } else if(state == START_TAG) { ++elStackDepth; //} else if(state == CONTENT) { // eventStart = contentEventStart; // eventEnd = contentEventEnd; } if(seenException != null && !gotContent) // allow report content if it was ok { Exception ex = seenException; seenException = null; String msg = ex.getMessage(); if(msg == null) { msg=""; } if(msg.endsWith(".")) { msg = msg.substring(0, msg.length() - 1); } throw new XmlPullParserException( "could not parse input: "+msg+getPosDesc(), ex ); } if(DEBUG) debug("# END state="+state(state) +" nextState="+state(nextState)+" emptyElement="+emptyElement); if(DEBUG && state == CONTENT) debug("# END content='"+escape(contentBuf.toString())+"'"); return state; } // -- generic methods /** * Reset parser and set new input. */ public void setInput(Reader reader) throws XmlPullParserException { resetState(); eventEnd = eventStart = 0; // sets to "" systemId to allow reporting line/column numbers ... cumulativeReader = new CumulativeReader(reader); inputSource = new XMLInputSource(null, "", null, cumulativeReader, null); needToSetInput = true; } /** * Reset parser and set new input. */ public void setInput(char[] buf) throws XmlPullParserException { setInput(new CharArrayReader(buf)); } public void setInput(char[] buf, int off, int len) throws XmlPullParserException { setInput(new CharArrayReader(buf, off, len)); } /** * Reset parser state so it can be used to parse new */ public void reset() { resetState(); } public boolean isAllowedMixedContent() { return allowedMixedContent; } /*

    Implementation notes: handling setAllowedMixedCotnet(...)

    on very high level

         //easy cases:
         xxx  StartTag --> (ERROR if seenContent)
         //harder cases:
         StartTag xxx EndTag --> always OK
         EndTag xxx EndTag --> (ERRORif seenContent)
         

    and this is how it is implemented modulo complexity of push callbacks ...

         onStartTag callback:
         if(nonWhitespaceContet) {
         ERROR;
         } else {
         IGNORE CONTENT
         }
         mixInElement = true;
         seenContent = false;
         nonWhitespaceContet = false
    
         onContent callback:
         seenContent = true;
         if (non whites space content) nonWhitespaceContet = true
    
         onEndTag callback:
         if(!mixInElement) {
         // seen end tag before;
         if(seenContent && nonWhitespaceContet) {
         ERROR
         } else {
         IGNORE CONTENT
         }
         }
         mixInElement = false
         
    */ /** * Allow for mixed element content. * Enabled by default. * When disbaled element must containt either text * or other elements. */ public void setAllowedMixedContent(boolean enable) throws XmlPullParserException { allowedMixedContent = enable; } public boolean isNamespaceAware() { return supportNs; } /** * Set support of namespaces. Disabled by default. */ public void setNamespaceAware(boolean awareness) throws XmlPullParserException { if(elStackDepth > 0 || seenRootElement) { throw new XmlPullParserException( "namespace support can only be set when not parsing"); } try { pullParserConfiguration.setFeature(NAMESPACES_FEATURE_ID, awareness); } catch (Exception e) { throw new XmlPullParserException( "parser does not support feature ("+NAMESPACES_FEATURE_ID+")", e); } supportNs = awareness; } public boolean isNamespaceAttributesReporting() { return reportNsAttribs; //throw new X2PullParserRuntimeException("not implemented"); } /** * Make parser to report xmlns* attributes. Disabled by default. * Only meaningful when namespaces are enabled (when namespaces * are disabled all attributes are always reported). */ public void setNamespaceAttributesReporting(boolean enable) throws XmlPullParserException { try { pullParserConfiguration.setFeature(NAMESPACE_PREFIXES_FEATURE_ID, enable); } catch (Exception e) { throw new XmlPullParserException( "parser does not support feature ("+NAMESPACE_PREFIXES_FEATURE_ID+")", e); } reportNsAttribs = enable; //throw new X2PullParserRuntimeException("not implemented"); } public String getNamespaceUri() { if(state != START_TAG && state != END_TAG) { throw new X2PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } X2ElementContent el = elStack[getDepth() - 1]; return el.uri; } public String getLocalName() { if(state != START_TAG && state != END_TAG) { throw new X2PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } X2ElementContent el = elStack[getDepth() - 1]; return el.localName; } public String getPrefix() { if(state != START_TAG && state != END_TAG) { throw new X2PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } X2ElementContent el = elStack[getDepth() - 1]; return el.prefix; } public String getRawName() { if(state != START_TAG && state != END_TAG) { throw new X2PullParserRuntimeException( "no end or start tag available to read"+getPosDesc()); } X2ElementContent el = elStack[getDepth() - 1]; return el.qName; } public String getQNameLocal(String qName) { int i = qName.lastIndexOf(':'); return qName.substring(i + 1); } public String getQNameUri(String qName) throws XmlPullParserException { if(elStackDepth == 0) { throw new XmlPullParserException( "parsing must be started to get uri from qname"); } int i = qName.lastIndexOf(':'); if(i > 0) { String prefix = qName.substring(0, i); return (String) prefix2Ns.get(prefix); } else { return elStack[elStackDepth-1].defaultNs; } } public int getDepth() { return (state != END_TAG) ? elStackDepth : elStackDepth + 1; } public int getNamespacesLength(int depth) { if(depth <= 0) throw new IllegalArgumentException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new IllegalArgumentException( "the depth "+depth+" that was passed for length of namespaces "+ " can not be bigger than current depth of "+maxDepth); } X2ElementContent el = elStack[ depth-1 ]; return el.prefixesEnd; } /** * Return namespace prefixes for element at depth */ public void readNamespacesPrefixes(int depth, String[] prefixes, int off, int len) throws XmlPullParserException { if(depth <= 0) throw new XmlPullParserException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new XmlPullParserException( "passed prefixes array of length "+depth+ " can not be bigger than current depth of "+maxDepth); } X2ElementContent el = elStack[ depth-1 ]; if(len > el.prefixesEnd) { throw new XmlPullParserException( "number of prefixes to copy "+len +" is bigger than available "+el.prefixesEnd); } System.arraycopy(el.prefixes, 0, prefixes, off, len); } /** * Return namespace URIs for element at depth */ public void readNamespacesUris(int depth, String[] uris, int off, int len) throws XmlPullParserException { if(depth <= 0) throw new XmlPullParserException( "element depth must be bigger than zero"); int maxDepth = getDepth(); if(depth > maxDepth) { throw new XmlPullParserException( "passed namespace URIs array of length "+depth+ " can not be bigger than current depth of "+maxDepth); } X2ElementContent el = elStack[ depth - 1 ]; if(len > el.prefixesEnd) { throw new XmlPullParserException( "number of namespace URIs to copy "+len +" is bigger than available "+el.prefixesEnd); } System.arraycopy(el.namespaceURIs, 0, uris, off, len); } private static int findFragment(int bufStart, char[] b, int start, int end) { //System.err.println("bufStart="+bufStart+" b="+escape(new String(b, start, end))+" start="+start+" end="+end); if(start < bufStart) { start = bufStart; if(start > end) start = end; return start; } if(end - start > 55) { start = end - 10; // try to find good location } int i = start + 1; while(--i > bufStart) { if((end - i) > 55) break; char c = b[i]; if(c == '<' && (start - i) > 10) break; } return i; } /** * Return string describing current position of parser in input stream as * text 'at line %d (row) and column %d (colum) [seen %s...]'. */ public String getPosDesc() { String fragment = ""; int bufStart = 0; int posStart = -1; int posEnd = - 1; try { if(locator != null) { posStart = 0; posEnd = getCurrentEntityAbsoluteOffset(); } // try more precise location - but it may fail if Xerces2 is not patched... posStart = getEventStart(); posEnd = getEventEnd(); } catch(Exception ex) { } //System.err.println("bufStart="+bufStart+" posStart="+posStart+" posEnd="+posEnd); if(posStart >= 0 && posEnd >= 0 && posStart <= posEnd) { char[] buf = getEventBuffer(); int start = findFragment(bufStart, buf, posStart, posEnd); //System.err.println("buf="+escape(new String(buf, posStart, posEnd - posStart))+" start="+start); if(start < posEnd) { fragment = new String(buf, start, posEnd - start); if(start > bufStart) fragment = "..." + fragment; } } String stateDesc = (state != -1) ? " (parser state "+state(state)+")" : ""; String systemId = (locator != null) ? locator.getExpandedSystemId() : null; String publicId = (locator != null) ? locator.getPublicId() : null; String baseSystemId = (locator != null) ? locator.getBaseSystemId() : null; if("".equals(systemId)) systemId = null; if("".equals(baseSystemId)) baseSystemId = null; String input = "" + (systemId != null ? " " + systemId : "") +(baseSystemId != null ? " baseSystemId='"+baseSystemId+"'" : "") +(publicId != null ? " publicId='"+publicId+"'" : ""); if(input.length() > 0) input = " in "+input; String position = ""; if(locator != null) { int posRow = locator.getLineNumber(); int posCol = locator.getColumnNumber(); position = " at line "+posRow +" and column "+(posCol-0); } return position +(fragment != null ? " seen: "+escape(fragment)+"..." : "") +input+stateDesc; } public int getLineNumber() { //return tokenizer.getLineNumber(); return locator != null ? locator.getLineNumber() : -1; } public int getColumnNumber() { //return tokenizer.getColumnNumber(); return locator != null ? locator.getColumnNumber() : -1; } public byte getEventType() { return state; } /** * Return true if just read CONTENT contained only white spaces. */ public boolean isWhitespaceContent() throws XmlPullParserException { if(state != CONTENT) throw new XmlPullParserException("no content available to read"); //return tokenizer.seenContent == false; String content = readContent(); for(int i = 0; i < content.length(); ++i) { char ch = content.charAt(i); if(ch != ' ' && ch != '\n' && ch != '\t' && ch != '\r') { return false; } } return true; } public int getContentLength() throws XmlPullParserException { if(state != CONTENT) throw new XmlPullParserException("no content available to read"); return contentBuf.length(); } /** * Return String that contains just read CONTENT. */ public String readContent() throws XmlPullParserException { if(state != CONTENT) throw new XmlPullParserException("no content available to read"); return contentBuf.toString(); } /** * Read value of just read END_TAG into passed as argument EndTag. */ public void readEndTag(XmlEndTag etag) throws XmlPullParserException { if(state != END_TAG) throw new XmlPullParserException( "no end tag available to read"+getPosDesc(), getLineNumber(), getColumnNumber()); //etag.qName = elStack[elStackDepth].qName; //etag.uri = elStack[elStackDepth].uri; //etag.localName = elStack[elStackDepth].localName; X2ElementContent el = elStack[elStackDepth]; etag.resetEndTag(); etag.modifyTag(el.uri, el.localName, el.qName); } /** * Read value of just read START_TAG into passed as argument StartTag. */ public void readStartTag(XmlStartTag stag) throws XmlPullParserException { if(state != START_TAG) throw new XmlPullParserException( "no start tag available to read"+getPosDesc(), getLineNumber(), getColumnNumber()); //if(beforeAtts == false) // throw new XmlPullParserException( // "start tag was already read"+getPosDesc(), getLineNumber(), getColumnNumber()); stag.resetStartTag(); X2ElementContent el = elStack[elStackDepth - 1]; //stag.qName = el.qName; //stag.uri = el.uri; //stag.localName = el.localName; stag.modifyTag(el.uri, el.localName, el.qName); // process atttributes stag.ensureAttributesCapacity(attrPosEnd); //stag.attEnd = attrPosEnd; for(int i = 0; i < attrPosEnd; ++i) { X2Attribute ap = attrPos[i]; // place for next attribute value //Attribute att = stag.attArr[i]; //att.qName = ap.qName; //att.localName = ap.localName; //att.value = ap.value; //att.uri = ap.uri; stag.addAttribute( ap.uri, ap.localName, ap.qName, ap.value); } } public void readNodeWithoutChildren(XmlNode node) throws XmlPullParserException { readStartTag(node); if(supportNs) { X2ElementContent el = elStack[elStackDepth-1]; node.setDefaultNamespaceUri(el.defaultNs); //System.err.println("adding my namespace size="+el.prefixesEnd); // for(int i = 0; i < el.prefixesEnd; i++) { // System.err.println("adding"+ // " el.prefixes["+i+"] = "+el.prefixes[i]+ // " el.namespaceURIs["+i+"] = "+el.namespaceURIs[i]); // } node.addDeclaredNamespaces( el.prefixes, 0, el.prefixesEnd, el.namespaceURIs); } // (state != END_TAG) ? elStackDepth : elStackDepth + 1; } public byte readNode(XmlNode node) throws XmlPullParserException, IOException { readNodeWithoutChildren(node); X2ElementContent el = elStack[elStackDepth-1]; int level = elStackDepth; //byte type = PullParser.END_TAG; //Stack stack = new Stack(); //stack.push(node); while(true) { byte state = next(); switch(state) { case XmlPullParser.START_TAG: XmlNode child = node.newNode(); readNodeWithoutChildren(child); //System.err.println("read "+child); // readStartTag(child); // if(supportNs) { // child.setDefaultNamespaceUri(el.defaultNs); // //System.err.println("adding namespace size="+el.prefixesEnd); // child.addDeclaredNamespaces( // el.prefixes, 0, el.prefixesEnd, el.namespaceURIs); // } node.appendChild(child); el = elStack[elStackDepth-1]; el.node = node; node = child; break; case XmlPullParser.CONTENT: // skip element content when it is empty string "" ... //if(eventEnd > eventStart) { if(DEBUG) debug("readNode() adding content "+escape(readContent())); node.appendChild(readContent()); //} break; case XmlPullParser.END_TAG: if(elStackDepth >= level) { node = elStack[elStackDepth].node; } else { return state; } break; } } } /** * If parser has just read start tag it allows to skip whoole * subtree contined in this element. Returns when encounters * end tag matching the start tag. */ public byte skipNode() throws XmlPullParserException, IOException { if(state != START_TAG) { throw new XmlPullParserException( "start tag must be read before skiping subtree"+getPosDesc(), getLineNumber(), getColumnNumber()); } int level = 1; byte type = XmlPullParser.END_TAG; while(level > 0) { type = next(); switch(type) { case XmlPullParser.START_TAG: ++level; break; case XmlPullParser.END_TAG: --level; break; } } return type; } // low level API: interface to parser internal data - good for perf public int getHardLimit() { //return tokenizer.getHardLimit(); throw new X2PullParserRuntimeException("not implemented"); } public void setHardLimit(int value) throws XmlPullParserException { //tokenizer.setHardLimit(value); throw new X2PullParserRuntimeException("not implemented"); } public int getSoftLimit() { //return tokenizer.getSoftLimit(); throw new X2PullParserRuntimeException("not implemented"); } public void setSoftLimit(int value) throws XmlPullParserException { //tokenizer.setSoftLimit(value); throw new X2PullParserRuntimeException("not implemented"); } public int getBufferShrinkOffset() { //return tokenizer.getBufferShrinkOffset(); //throw new X2PullParserRuntimeException("not implemented"); return cumulativeReader.getCumulativeBufferAbsoluteEnd() - cumulativeReader.getCumulativeBufferEnd(); } public void setBufferShrinkable(boolean shrinkable) throws XmlPullParserException { //tokenizer.setBufferShrinkable(shrinkable); //throw new X2PullParserRuntimeException("not implemented"); this.shrinkable = shrinkable; cumulativeReader.setCumulative( ! shrinkable ); } public boolean isBufferShrinkable() { //return tokenizer.isBufferShrinkable(); //throw new X2PullParserRuntimeException("not implemented"); return shrinkable; } public int getEventStart() { int pos = (state == CONTENT ? contentEventStart : eventStart); if( pos == -1) { throw new X2PullParserRuntimeException( "unpatched Xerces2 does not support event positioning" +" - apply relevant patch or use patched xerces2 jar"); } //throw new X2PullParserRuntimeException("not implemented"); return pos; } // eventStart = tokenizer.pos, parsing..., eventEnd = tokenizer.pos } public int getEventEnd() { int pos = (state == CONTENT ? contentEventEnd : eventEnd); if( pos == -1) { throw new X2PullParserRuntimeException( "unpatched Xerces2 does not support event positioning" +" - apply relevant patch or use patched xerces2 jar"); } //throw new X2PullParserRuntimeException("not implemented"); return pos; //return state == CONTENT ? contentEventEnd : eventEnd; //return eventEnd; //state == CONTENT ? contentBuf.length() : eventEnd; //throw new X2PullParserRuntimeException("not implemented"); } // equivalent to tokenizer.buf ALWAYS (never tokenizer.pc) public char[] getEventBuffer() { //return tokenizer.buf; //throw new X2PullParserRuntimeException("not implemented"); return cumulativeReader.getCumulativeBuffer(); //return (state == CONTENT) ? //contentBuf.toString().toCharArray() //: cumulativeReader.getCumulativeBuffer(); } // ====== utility methods /** * Make sure that we have enough space to keep element stack if passed size. */ protected void ensureCapacity(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 if(elStackSize < newSize) { if(TRACE_SIZING) { System.err.println("elStack "+elStackSize+" ==> "+newSize); } X2ElementContent[] newStack = new X2ElementContent[newSize]; if(elStack != null) { System.arraycopy(elStack, 0, newStack, 0, elStackSize); } for(int i = elStackSize; i < newSize; ++i) { newStack[i] = new X2ElementContent(); } elStack = newStack; elStackSize = newSize; } } /** * Make sure that in attributes temporary array is enough space. */ protected void ensureAttribs(int size) { int newSize = 2 * size; if(newSize == 0) newSize = 8; // = lucky 7 + 1 //25 if(attrPosEnd < newSize) { if(TRACE_SIZING) { System.err.println("attrPos "+attrPosSize+" ==> "+newSize); } X2Attribute[] newAttrPos = new X2Attribute[newSize]; if(attrPos != null) { System.arraycopy(attrPos, 0, newAttrPos, 0, attrPosSize); } for(int i = attrPosSize; i < newSize; ++i) { newAttrPos[i] = new X2Attribute(); //inner classes are weird :-) } attrPos = newAttrPos; attrPosSize = newSize; } } protected void resetState() { //tokenizer.paramNotifyDoctype = true; state = -1; nextState = -1; eventStart = -1; elStackDepth = 0; prefix2Ns.clear(); // 4. NC: Prefix Declared prefix2Ns.put("xml", "http://www.w3.org/XML/1998/namespace"); //beforeAtts = false; //emptyElementContent = emptyElement = false; seenRootElement = false; //scache = new StringCache(); needToSetInput = false; } protected class CumulativeReader extends Reader { private Reader source; private boolean cumulative; //private char[] cumulativeBuf; private int bufAbsoluteStart; private int bufAbsoluteEnd; private char[] buf = new char[10 * 1024]; private int bufStart; private int bufEnd; /** Constructs this reader from another reader. */ public CumulativeReader(Reader reader) { source = reader; } public void setCumulative(boolean value) { cumulative = value; if(cumulative) { char[] newBuf = new char[buf.length + 10 * 1024]; if(bufEnd > bufStart) { System.arraycopy(buf, bufStart, newBuf, 0, bufEnd - bufStart); } bufEnd = bufEnd - bufStart; bufStart = 0; } } public boolean getCumulative() { return cumulative; } public char[] getCumulativeBuffer() { return buf; } public int getCumulativeBufferAbsoluteStart() { return bufAbsoluteStart; } public int getCumulativeBufferAbsoluteEnd() { return bufAbsoluteEnd; } public int getCumulativeBufferStart() { return bufStart; } public int getCumulativeBufferEnd() { return bufEnd; } // // Reader methods // // ignore closing public void close() { } public int read(char[] ch, int offset, int length) throws IOException { // read form original int ret = source.read(ch, offset, length); if(ret > 0) { if(!cumulative) { buf = ch; bufStart = offset; bufEnd = offset + ret; bufAbsoluteStart = bufAbsoluteEnd; } else { // append ch to buf at bufAbsoluteEnd int newLen = bufEnd + length; if(buf.length < newLen) { char[] newBuf = new char[newLen + 10 * 1024]; System.arraycopy(buf, bufStart, newBuf, 0, bufEnd - bufStart); bufEnd = bufEnd - bufStart; bufStart = 0; } System.arraycopy(ch, offset, buf, bufEnd, ret); bufEnd += ret; } bufAbsoluteEnd += ret; } return ret; } } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ ././@LongLink0000644000175000017500000000015210232455272011324 Lustar 00000000000000PullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/X2PullParserRuntimeException.javaPullParser2.1.10/src/java/x2/pullparser/org/gjt/xpp/x2impl/x2pullparser/X2PullParserRuntimeException0000644000175000017500000001055707755336257034027 0ustar wbaerwbaer00000000000000/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ /* * Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. * * This software is open source. See the bottom of this file for the licence. * * $Id: X2PullParserRuntimeException.java,v 1.4 2003/04/06 00:04:03 aslom Exp $ */ package org.gjt.xpp.x2impl.x2pullparser; /** * Extended runtime excpetion to allow chaining. * * @author Aleksander Slominski */ public class X2PullParserRuntimeException extends RuntimeException { protected Throwable detail; public X2PullParserRuntimeException(String s) { super(s); } public X2PullParserRuntimeException(String s, Throwable thrwble) { super(s); this.detail = thrwble; } public X2PullParserRuntimeException(Throwable thrwble) { this("Pull Parser runtime exception", thrwble); } public Throwable getDetail() { return detail; } public void setDetail(Throwable cause) { this.detail = cause; } public String getMessage() { if(detail == null) return super.getMessage(); else return super.getMessage() + "; nested exception is: \n\t" + detail.getMessage()+" "; } public void printStackTrace() { //System.err.println("YYYYYYY"); if (detail == null) { super.printStackTrace(); } else { synchronized(System.err) { System.err.println(super.getMessage() + "; nested exception is: YY"); detail.printStackTrace(); } } //System.err.println("YYYYYYY2"); } } /* * Indiana University Extreme! Lab Software License, Version 1.2 * * Copyright (C) 2002 The Trustees of Indiana University. * 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) All redistributions of source code must retain the above * copyright notice, the list of authors in the original source * code, this list of conditions and the disclaimer listed in this * license; * * 2) All redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the disclaimer * listed in this license in the documentation and/or other * materials provided with the distribution; * * 3) Any documentation included with all redistributions must include * the following acknowledgement: * * "This product includes software developed by the Indiana * University Extreme! Lab. For further information please visit * http://www.extreme.indiana.edu/" * * Alternatively, this acknowledgment may appear in the software * itself, and wherever such third-party acknowledgments normally * appear. * * 4) The name "Indiana University" or "Indiana University * Extreme! Lab" shall not be used to endorse or promote * products derived from this software without prior written * permission from Indiana University. For written permission, * please contact http://www.extreme.indiana.edu/. * * 5) Products derived from this software may not use "Indiana * University" name nor may "Indiana University" appear in their name, * without prior written permission of the Indiana University. * * Indiana University provides no reassurances that the source code * provided does not infringe the patent or any other intellectual * property rights of any other entity. Indiana University disclaims any * liability to any recipient for claims brought by any other entity * based on infringement of intellectual property rights or otherwise. * * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING * SOFTWARE. */ PullParser2.1.10/src/java/x2/README.txt0000644000175000017500000000033207755336266017611 0ustar wbaerwbaer00000000000000This is implementation of XPP2 API.that uses Xerces 2 XNI. factory - creation of X2 pullparser (other classes are taken from default ../impl) pullparser - translation of Xerces 2 XNI pull parsers callbacks into XPP2 PullParser2.1.10/build.xml0000644000175000017500000007537307755336263015711 0ustar wbaerwbaer00000000000000 PullParser2.1.10/LICENSE.txt0000644000175000017500000000507507755336265015705 0ustar wbaerwbaer00000000000000LICENSE FOR THE Extreme! Lab PullParser ------------------------------------------------------------------------ Copyright 2002 The Trustees of Indiana University. 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) All redistributions of source code must retain the above copyright notice, the list of authors in the original source code, this list of conditions and the disclaimer listed in this license; 2) All redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer listed in this license in the documentation and/or other materials provided with the distribution; 3) Any documentation included with all redistributions must include the following acknowledgement: "This product includes software developed by the Indiana University Extreme! Lab. For further information please visit http://www.extreme.indiana.edu/" Alternatively, this acknowledgment may appear in the software itself, and wherever such third-party acknowledgments normally appear. 4) The name "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" shall not be used to endorse or promote products derived from this software without prior written permission from Indiana University. For written permission, please contact http://www.extreme.indiana.edu/. 5) Products derived from this software may not use "Indiana Univeristy" name nor may "Indiana Univeristy" appear in their name, without prior written permission of the Indiana University. Indiana University provides no reassurances that the source code provided does not infringe the patent or any other intellectual property rights of any other entity. Indiana University disclaims any liability to any recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NOWARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING SOFTWARE. PullParser2.1.10/README.html0000644000175000017500000000265507755336265015706 0ustar wbaerwbaer00000000000000 Pull Parser 2 Documentation

    Pull Parser 2 Documentation

    Overview

    System Requirements

    How to run instructions.

    How to build instructions.

    J2ME environment: building samples.

    FAQ

    List of changes

    API documentation

    Thanks!

    For the latest version and more information please see: XML Pull Parser 2 Home Page and discussion list for XPP2 and SoapRMI.

    Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. and see Indiana University Extreme! Lab Software License.


    Aleksander Slominski