xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject svn commit: r125213 - in xmlbeans/trunk: . src/common/org/apache/xmlbeans/impl/common src/newstore2/org/apache/xmlbeans/impl/newstore2 src/typeimpl/org/apache/xmlbeans/impl/values src/xpath_xquery src/xpath_xquery/org src/xpath_xquery/org/apache src/xpath_xquery/org/apache/xmlbeans src/xpath_xquery/org/apache/xmlbeans/impl src/xpath_xquery/org/apache/xmlbeans/impl/xpath src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon src/xpath_xquery/org/apache/xmlbeans/impl/xquery src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon test/cases/xbean/scomp/derivation/facets test/src/scomp/derivation/restriction/facets/detailed test/src/xmlcursor/checkin test/src/xmlcursor/common test/src/xmlcursor/xpath/common test/src/xmlcursor/xpath/jaxen/detailed test/src/xmlcursor/xpath/xbean_xpath/detailed test/src/xmlobject/checkin
Date Fri, 14 Jan 2005 21:48:31 GMT
Author: cezar
Date: Fri Jan 14 13:48:30 2005
New Revision: 125213

URL: http://svn.apache.org/viewcvs?view=rev&rev=125213
Log:
Checking in Yana's patch to enable Saxon as xpath and xquery engine. codereview: Cezar Andrei checkintest: passes
Added:
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/SaxonXBeansDelegate.java
   xmlbeans/trunk/src/xpath_xquery/
   xmlbeans/trunk/src/xpath_xquery/org/
   xmlbeans/trunk/src/xpath_xquery/org/apache/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansStandaloneContext.java
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/
   xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
Modified:
   xmlbeans/trunk/build.xml
   xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java
   xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java
   xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
   xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd
   xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java
   xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java
   xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java
   xmlbeans/trunk/test/src/xmlcursor/common/Common.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java
   xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java
   xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java
   xmlbeans/trunk/testbuild.xml

Modified: xmlbeans/trunk/build.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/build.xml?view=diff&rev=125213&p1=xmlbeans/trunk/build.xml&r1=125212&p2=xmlbeans/trunk/build.xml&r2=125213
==============================================================================
--- xmlbeans/trunk/build.xml	(original)
+++ xmlbeans/trunk/build.xml	Fri Jan 14 13:48:30 2005
@@ -1,703 +1,722 @@
 <project name="Xbean" default="default" basedir=".">
 
-  <property name="build.compiler" value="javac1.4"/>
-  <property name="javac.source" value="1.4"/>
-  <property name="javac.target" value="1.4"/>
-  <property name="jam_root" value="jam"/>
-
-  <property name="product.version" value="2.0.0-beta1"/>
-
-  <!-- manifest entries -->
-  <property name="manifest.name" value="org/apache/xmlbeans/"/>
-  <property name="manifest.title" value="org.apache.xmlbeans"/>
-  <property name="manifest.vendor" value="Apache Software Foundation"/>
-  <property name="manifest.url" value="http://xmlbeans.apache.org/"/>
-  <property name="manifest.comment" value="Apache XmlBeans version ${product.version}"/>
-
-  <!-- needs to be the same as 'classes_dir' in jam/build.xml -->
-  <property name="jam_classes_dir" value="${jam_root}/build/classes"/>
-
-  <target name="usage">
-    <echo message="The following ant targets are defined:"/>
-    <echo/>
-    <echo message="usage       - this help text"/>
-    <echo message="deploy      - builds our implementation jar (xbean.jar)"/>
-    <echo message="clean       - cleans out the xbeans directories"/>
-    <echo/>
-    <echo message="testbuild   - builds, but does not run, the xbean drt"/>
-    <echo message="checkintest - runs the xbean tests"/>
-  </target>
-
-  <target name="java_version">
-    <echo message="${java.version}" />
-  </target>
-
-  <target name="clean">
-    <delete dir="build"/>
-  </target>
-
-  <target name="deploy" depends="xbean" />
-
-  <target name="sources" depends="dirs">
-    <zip destfile="build/ar/xbeansrc.zip" basedir="." excludes="build/**"/>
-  </target>
-
-  <target name="check.jsr173.jar">
-    <condition property="jsr173.jar.exists">
-        <available file="build/lib/jsr173.jar"/>
-    </condition>
-  </target>
-
-  <target name="jsr173.jar" depends="check.jsr173.jar, dirs" unless="jsr173.jar.exists">
-    <get dest="build/lib/jsr173.jar"
-         src="http://workshop.bea.com/xmlbeans/jsr173v1/jsr173.jar"
-         verbose="true" usetimestamp="true" ignoreerrors="true"/>
-  </target>
-
-  <target name="check.jsr173_api.jar">
-    <condition property="jsr173_api.jar.exists">
-        <available file="build/lib/jsr173_api.jar"/>
-    </condition>
-  </target>
-
-  <target name="jsr173_api.jar" depends="jsr173.jar, jsr173_ri.jar, check.jsr173_api.jar" unless="jsr173_api.jar.exists">
-    <unjar src="build/lib/jsr173.jar" dest="build/lib">
-      <patternset>
-        <include name="jsr173_1.0_api.jar"/>
-    </patternset>
-    </unjar>
-    <move file="build/lib/jsr173_1.0_api.jar" tofile="build/lib/jsr173_api.jar"/>
-  </target>
-
-  <target name="check.jsr173_ri.jar">
-    <condition property="jsr173_ri.jar.exists">
-        <available file="build/lib/jsr173_ri.jar"/>
-    </condition>
-  </target>
-
-  <target name="jsr173_ri.jar" depends="jsr173.jar, check.jsr173_ri.jar" unless="jsr173_ri.jar.exists">
-    <unjar src="build/lib/jsr173.jar" dest="build/lib">
-      <patternset>
-        <include name="jsr173_1.0_ri.jar"/>
-    </patternset>
-    </unjar>
-    <move file="build/lib/jsr173_1.0_ri.jar" tofile="build/lib/jsr173_ri.jar"/>
-  </target>
+    <property name="build.compiler" value="javac1.4"/>
+    <property name="javac.source" value="1.4"/>
+    <property name="javac.target" value="1.4"/>
+    <property name="jam_root" value="jam"/>
+
+    <property name="product.version" value="2.0.0-beta1"/>
+
+    <!-- manifest entries -->
+    <property name="manifest.name" value="org/apache/xmlbeans/"/>
+    <property name="manifest.title" value="org.apache.xmlbeans"/>
+    <property name="manifest.vendor" value="Apache Software Foundation"/>
+    <property name="manifest.url" value="http://xmlbeans.apache.org/"/>
+    <property name="manifest.comment" value="Apache XmlBeans version ${product.version}"/>
+
+    <!-- needs to be the same as 'classes_dir' in jam/build.xml -->
+    <property name="jam_classes_dir" value="${jam_root}/build/classes"/>
+
+    <target name="usage">
+        <echo message="The following ant targets are defined:"/>
+        <echo/>
+        <echo message="usage       - this help text"/>
+        <echo message="deploy      - builds our implementation jar (xbean.jar)"/>
+        <echo message="clean       - cleans out the xbeans directories"/>
+        <echo/>
+        <echo message="testbuild   - builds, but does not run, the xbean drt"/>
+        <echo message="checkintest - runs the xbean tests"/>
+    </target>
+
+    <target name="java_version">
+        <echo message="${java.version}"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="build"/>
+    </target>
+
+    <target name="deploy" depends="xbean"/>
+
+    <target name="sources" depends="dirs">
+        <zip destfile="build/ar/xbeansrc.zip" basedir="." excludes="build/**"/>
+    </target>
+
+    <target name="check.saxon8.2.jar">
+        <condition property="saxon8.2.jar.exists">
+            <available file="build/lib/saxon8.jar"/>
+        </condition>
+    </target>
+
+    <target name="saxon8.2.jar" depends="check.saxon8.2.jar, dirs"
+        unless="saxon8.2.jar.exists">
+        <get dest="build/lib/saxonb8-2.zip"
+            src="http://voxel.dl.sourceforge.net/sourceforge/saxon/saxonb8-1-1.zip"
+            verbose="true" usetimestamp="true" ignoreerrors="true"/>
+        <unzip src="build/lib/saxonb8-2.zip" dest="build/lib/">
+            <patternset>
+                <include name="saxon8.jar"/>
+            </patternset>
+        </unzip>
+
+    </target>
+
+    <target name="check.jsr173.jar">
+        <condition property="jsr173.jar.exists">
+            <available file="build/lib/jsr173.jar"/>
+        </condition>
+    </target>
+
+    <target name="jsr173.jar" depends="check.jsr173.jar, dirs" unless="jsr173.jar.exists">
+        <get dest="build/lib/jsr173.jar"
+            src="http://workshop.bea.com/xmlbeans/jsr173v1/jsr173.jar"
+            verbose="true" usetimestamp="true" ignoreerrors="true"/>
+    </target>
+
+    <target name="check.jsr173_api.jar">
+        <condition property="jsr173_api.jar.exists">
+            <available file="build/lib/jsr173_api.jar"/>
+        </condition>
+    </target>
+
+    <target name="jsr173_api.jar" depends="jsr173.jar, jsr173_ri.jar, check.jsr173_api.jar" unless="jsr173_api.jar.exists">
+        <unjar src="build/lib/jsr173.jar" dest="build/lib">
+            <patternset>
+                <include name="jsr173_1.0_api.jar"/>
+            </patternset>
+        </unjar>
+        <move file="build/lib/jsr173_1.0_api.jar" tofile="build/lib/jsr173_api.jar"/>
+    </target>
+
+    <target name="check.jsr173_ri.jar">
+        <condition property="jsr173_ri.jar.exists">
+            <available file="build/lib/jsr173_ri.jar"/>
+        </condition>
+    </target>
+
+    <target name="jsr173_ri.jar" depends="jsr173.jar, check.jsr173_ri.jar" unless="jsr173_ri.jar.exists">
+        <unjar src="build/lib/jsr173.jar" dest="build/lib">
+            <patternset>
+                <include name="jsr173_1.0_ri.jar"/>
+            </patternset>
+        </unjar>
+        <move file="build/lib/jsr173_1.0_ri.jar" tofile="build/lib/jsr173_ri.jar"/>
+    </target>
 
     <!-- get resolver.jar -->
     <target name="check.xcresolver.zip">
-      <condition property="xcresolver.zip.exists">
-          <available file="build/lib/xcresolver.zip"/>
-      </condition>
+        <condition property="xcresolver.zip.exists">
+            <available file="build/lib/xcresolver.zip"/>
+        </condition>
     </target>
 
     <target name="xcresolver.zip" depends="check.xcresolver.zip, dirs" unless="xcresolver.zip.exists">
-      <get dest="build/lib/xcresolver.zip"
-           src="http://www.apache.org/dist/xml/commons/binaries/xml-commons-resolver-1.1.zip"
-           verbose="true" usetimestamp="true" ignoreerrors="true"/>
+        <get dest="build/lib/xcresolver.zip"
+            src="http://www.apache.org/dist/xml/commons/binaries/xml-commons-resolver-1.1.zip"
+            verbose="true" usetimestamp="true" ignoreerrors="true"/>
     </target>
 
     <target name="check.resolver.jar">
-      <condition property="resolver.jar.exists">
-          <available file="build/lib/resolver.jar"/>
-      </condition>
+        <condition property="resolver.jar.exists">
+            <available file="build/lib/resolver.jar"/>
+        </condition>
     </target>
 
     <target name="resolver.jar" depends="xcresolver.zip, check.resolver.jar" unless="resolver.jar.exists">
-      <unzip src="build/lib/xcresolver.zip" dest="build/lib/">
-        <patternset>
-          <include name="*/resolver.jar"/>
-      </patternset>
-      </unzip>
-      <move file="build/lib/xml-commons-resolver-1.1/resolver.jar" tofile="build/lib/resolver.jar"/>
-      <delete dir="build/lib/xml-commons-resolver-1.1" />
-      <delete file="build/lib/xcresolver.zip" />
-    </target>
-
-
-  <target name="xbean" depends="xbean.jar">
-    <copy file="build/lib/xbean.jar" tofile="build/ar/xbean.jar"/>
-  </target>
-
-  <target name="dirs">
-    <mkdir dir="build"/>
-    <mkdir dir="build/classes"/>
-    <mkdir dir="build/lib"/>
-    <mkdir dir="build/ar"/>
-    <mkdir dir="build/src"/>
-    <mkdir dir="build/private"/>
-    <mkdir dir="build/private/classes"/>
-    <mkdir dir="build/private/lib"/>
-    <mkdir dir="build/test/output"/>
-  </target>
-
-  <target name="default" depends="deploy"/>
-  <target name="redeploy" depends="clean, deploy"/>
-
-  <!-- oldxbean.jar target =========================================== -->
-
-  <target name="oldxbean.jar">
-    <copy file="external/lib/oldxbean.jar" tofile="build/private/lib/oldxbean.jar"/>
-  </target>
-
-  <!-- bootstrap target ============================================== -->
-
-  <target name="bootstrap" depends="xbean">
-
-    <!-- after xbean.jar is built, move it out of the way and clean the project -->
-    <tempfile property="bootstrap.jarfile" prefix="oldxbean" suffix=".jar"/>
-    <move file="build/ar/xbean.jar" tofile="${bootstrap.jarfile}"/>
-    <antcall target="clean" inheritAll="false"/>
-
-    <!-- then move it back into place as oldxbean.jar and do another build -->
-    <move file="${bootstrap.jarfile}" tofile="build/private/lib/oldxbean.jar"/>
-    <antcall target="xbean" inheritAll="false"/>
-
-    <!-- compare the contents of the first jar to the contents of the second jar -->
-    <antcall target="zipcompare.classes" inheritAll="false"/>
-    <java classname="zipcompare.ZipCompare"
-          classpath="build/private/classes/zipcompare"
-          fork="true"
-          failonerror="true">
-      <arg line="build/ar/xbean.jar build/private/lib/oldxbean.jar"/>
-    </java>
-
-    <!-- when everything succeeds, check out oldxbean.jar from perforce -->
-    <echo message="==================================="/>
-    <echo message="Results match! Bootstrap succeeded."/>
-    <echo message="==================================="/>
-    <echo message="Attempting to copy oldxbean.jar"/>
-    <echo message="If the copy fails, you must check out oldxbean.jar"/>
-    <!-- copy oldxbean.jar whether or not perforce succeeded -->
-    <echo message="overwriting old external/lib/oldxbean.jar"/>
-    <copy file="build/private/lib/oldxbean.jar" tofile="external/lib/oldxbean.jar"/>
-  </target>
-
-  <target name="quickbootstrap">
-    <echo message="=========================================================="/>
-    <echo message="Bootstrapping currently built xbean.jar without verifying."/>
-    <echo message="=========================================================="/>
-    <copy file="build/ar/xbean.jar" tofile="external/lib/oldxbean.jar"/>
-  </target>
-
-
-  <!-- zipcompare (for checking bootstrap) ============================ -->
-
-  <target name="zipcompare.classes">
-    <mkdir dir="build/private/classes/zipcompare"/>
-    <javac srcdir="src/zipcompare"
-           source="${javac.source}" target="${javac.target}"
-           destdir="build/private/classes/zipcompare"
-           debug="on"/>
-  </target>
-
-  <!-- javadocs ====================================================== -->
-
-  <!-- All docs to build/docs, including guide and javadocs. -->
-
-  <target name="docs" depends="xbean">
-    <property name="docs.dir" value="build/docs"/>
-    <delete dir="${docs.dir}"/>
-    <mkdir dir="${docs.dir}"/>
-    <javadoc packagenames="*" sourcepath="src/xmlpublic" classpath="${javadoc.path}" destdir="${docs.dir}/reference" windowtitle="XMLBeans Documentation" source="${javac.source}" stylesheetfile="docs/stylesheet.css">
-      <link href="http://e-docs.bea.com/wls/docs81/javadocs/"/>
-      <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
-      <link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
-      <link href="http://xml.apache.org/xerces-j/apiDocs/"/>
-      <classpath>
-        <pathelement location="build/ar/xbean.jar"/>
-      </classpath>
-    </javadoc>
-    <copy file="docs/xmlbeans.css" tofile="${docs.dir}/xmlbeans.css" />
-    <copy todir="${docs.dir}/guide">
-      <fileset dir="docs/guide"/>
-    </copy>
-    <copy todir="${docs.dir}/images">
-      <fileset dir="docs/images"/>
-    </copy>
-  </target>
-
-
-  <target name="dist" depends="dist-src, dist-bin">
-  </target>
-
-  <target name="dist-bin" depends="xbean, docs">
-     <delete dir="build/private/xmlbeans-${product.version}"/>
-     <delete file="build/private/incubating-xmlbeans-${product.version}.zip"/>
-     <delete file="build/private/incubating-xmlbeans-${product.version}.tgz"/>
-
-     <mkdir dir="build/private/xmlbeans-${product.version}"/>
-     <copy todir="build/private/xmlbeans-${product.version}">
-        <fileset dir="xkit"/>
-        <fileset dir="." includes="bin/**"/>
-     </copy>
-     <copy todir="build/private/xmlbeans-${product.version}/schemas/s4s">
-        <fileset dir="src/xsdschema/schema" includes="XMLSchema.xsd"/>
-        <fileset dir="src/xmlschema/schema" includes="XML.xsd"/>
-     </copy>
-     <copy todir="build/private/xmlbeans-${product.version}/schemas">
-        <fileset dir="test/src" includes="easypo/*.xsd,easypo/*.xsdconfig"/>
-        <fileset dir="test/cases/schema" includes="cyclone/**/*.xsd,j2ee/*.xsd"/>
-     </copy>
-
-     <mkdir dir="build/private/xmlbeans-${product.version}/lib"/>
-     <copy todir="build/private/xmlbeans-${product.version}/lib" file="build/ar/xbean.jar"/>
-
-     <mkdir dir="build/private/xmlbeans-${product.version}/src/schema"/>
-     <copy todir="build/private/xmlbeans-${product.version}/src/schema">
-        <fileset dir="src/toolschema"/>
-     </copy>
-
-     <mkdir dir="build/private/xmlbeans-${product.version}/docs"/>
-     <copy todir="build/private/xmlbeans-${product.version}/docs">
-        <fileset dir="build/docs"/>
-     </copy>
-
-     <zip destfile="build/private/incubating-xmlbeans-${product.version}.zip"
-          basedir="build/private"
-          includes="xmlbeans-${product.version}/**"/>
-     <tar destfile="build/private/incubating-xmlbeans-${product.version}.tgz"
-          basedir="build/private"
-          includes="xmlbeans-${product.version}/**"
-          compression="gzip"/>
-  </target>
-
-  <target name="dist-src" depends="clean, dirs">
-     <delete file="build/private/incubating-xmlbeans-${product.version}-src.zip"/>
-     <delete file="build/private/incubating-xmlbeans-${product.version}-src.tgz"/>
-
-     <zip destfile="build/private/incubating-xmlbeans-${product.version}-src.zip">
-        <zipfileset
-            dir="."
-            includes="**"
-            excludes="build/**"
-            prefix="xmlbeans-${product.version}"/>
-     </zip>
-     <tar destfile="build/private/incubating-xmlbeans-${product.version}-src.tgz"
-          compression="gzip">
-        <tarfileset
-            dir="."
-            includes="**"
-            excludes="build/**"
-            prefix="xmlbeans-${product.version}"/>
-     </tar>
-  </target>
+        <unzip src="build/lib/xcresolver.zip" dest="build/lib/">
+            <patternset>
+                <include name="*/resolver.jar"/>
+            </patternset>
+        </unzip>
+        <move file="build/lib/xml-commons-resolver-1.1/resolver.jar" tofile="build/lib/resolver.jar"/>
+        <delete dir="build/lib/xml-commons-resolver-1.1"/>
+        <delete file="build/lib/xcresolver.zip"/>
+    </target>
+
+
+    <target name="xbean" depends="xbean.jar">
+        <copy file="build/lib/xbean.jar" tofile="build/ar/xbean.jar"/>
+    </target>
+
+    <target name="dirs">
+        <mkdir dir="build"/>
+        <mkdir dir="build/classes"/>
+        <mkdir dir="build/lib"/>
+        <mkdir dir="build/ar"/>
+        <mkdir dir="build/src"/>
+        <mkdir dir="build/private"/>
+        <mkdir dir="build/private/classes"/>
+        <mkdir dir="build/private/lib"/>
+        <mkdir dir="build/test/output"/>
+    </target>
+
+    <target name="default" depends="deploy"/>
+    <target name="redeploy" depends="clean, deploy"/>
+
+    <!-- oldxbean.jar target =========================================== -->
+
+    <target name="oldxbean.jar">
+        <copy file="external/lib/oldxbean.jar" tofile="build/private/lib/oldxbean.jar"/>
+    </target>
+
+    <!-- bootstrap target ============================================== -->
+
+    <target name="bootstrap" depends="xbean">
+
+        <!-- after xbean.jar is built, move it out of the way and clean the project -->
+        <tempfile property="bootstrap.jarfile" prefix="oldxbean" suffix=".jar"/>
+        <move file="build/ar/xbean.jar" tofile="${bootstrap.jarfile}"/>
+        <antcall target="clean" inheritAll="false"/>
+
+        <!-- then move it back into place as oldxbean.jar and do another build -->
+        <move file="${bootstrap.jarfile}" tofile="build/private/lib/oldxbean.jar"/>
+        <antcall target="xbean" inheritAll="false"/>
+
+        <!-- compare the contents of the first jar to the contents of the second jar -->
+        <antcall target="zipcompare.classes" inheritAll="false"/>
+        <java classname="zipcompare.ZipCompare"
+            classpath="build/private/classes/zipcompare"
+            fork="true"
+            failonerror="true">
+            <arg line="build/ar/xbean.jar build/private/lib/oldxbean.jar"/>
+        </java>
+
+        <!-- when everything succeeds, check out oldxbean.jar from perforce -->
+        <echo message="==================================="/>
+        <echo message="Results match! Bootstrap succeeded."/>
+        <echo message="==================================="/>
+        <echo message="Attempting to copy oldxbean.jar"/>
+        <echo message="If the copy fails, you must check out oldxbean.jar"/>
+        <!-- copy oldxbean.jar whether or not perforce succeeded -->
+        <echo message="overwriting old external/lib/oldxbean.jar"/>
+        <copy file="build/private/lib/oldxbean.jar" tofile="external/lib/oldxbean.jar"/>
+    </target>
+
+    <target name="quickbootstrap">
+        <echo message="=========================================================="/>
+        <echo message="Bootstrapping currently built xbean.jar without verifying."/>
+        <echo message="=========================================================="/>
+        <copy file="build/ar/xbean.jar" tofile="external/lib/oldxbean.jar"/>
+    </target>
+
 
-  <target name="enum-support.jar"
+    <!-- zipcompare (for checking bootstrap) ============================ -->
+
+    <target name="zipcompare.classes">
+        <mkdir dir="build/private/classes/zipcompare"/>
+        <javac srcdir="src/zipcompare"
+            source="${javac.source}" target="${javac.target}"
+            destdir="build/private/classes/zipcompare"
+            debug="on"/>
+    </target>
+
+    <!-- javadocs ====================================================== -->
+
+    <!-- All docs to build/docs, including guide and javadocs. -->
+
+    <target name="docs" depends="xbean">
+        <property name="docs.dir" value="build/docs"/>
+        <delete dir="${docs.dir}"/>
+        <mkdir dir="${docs.dir}"/>
+        <javadoc packagenames="*" sourcepath="src/xmlpublic" classpath="${javadoc.path}" destdir="${docs.dir}/reference" windowtitle="XMLBeans Documentation" source="${javac.source}" stylesheetfile="docs/stylesheet.css">
+            <link href="http://e-docs.bea.com/wls/docs81/javadocs/"/>
+            <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+            <link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
+            <link href="http://xml.apache.org/xerces-j/apiDocs/"/>
+            <classpath>
+                <pathelement location="build/ar/xbean.jar"/>
+            </classpath>
+        </javadoc>
+        <copy file="docs/xmlbeans.css" tofile="${docs.dir}/xmlbeans.css"/>
+        <copy todir="${docs.dir}/guide">
+            <fileset dir="docs/guide"/>
+        </copy>
+        <copy todir="${docs.dir}/images">
+            <fileset dir="docs/images"/>
+        </copy>
+    </target>
+
+
+    <target name="dist" depends="dist-src, dist-bin">
+    </target>
+
+    <target name="dist-bin" depends="xbean, docs">
+        <delete dir="build/private/xmlbeans-${product.version}"/>
+        <delete file="build/private/incubating-xmlbeans-${product.version}.zip"/>
+        <delete file="build/private/incubating-xmlbeans-${product.version}.tgz"/>
+
+        <mkdir dir="build/private/xmlbeans-${product.version}"/>
+        <copy todir="build/private/xmlbeans-${product.version}">
+            <fileset dir="xkit"/>
+            <fileset dir="." includes="bin/**"/>
+        </copy>
+        <copy todir="build/private/xmlbeans-${product.version}/schemas/s4s">
+            <fileset dir="src/xsdschema/schema" includes="XMLSchema.xsd"/>
+            <fileset dir="src/xmlschema/schema" includes="XML.xsd"/>
+        </copy>
+        <copy todir="build/private/xmlbeans-${product.version}/schemas">
+            <fileset dir="test/src" includes="easypo/*.xsd,easypo/*.xsdconfig"/>
+            <fileset dir="test/cases/schema" includes="cyclone/**/*.xsd,j2ee/*.xsd"/>
+        </copy>
+
+        <mkdir dir="build/private/xmlbeans-${product.version}/lib"/>
+        <copy todir="build/private/xmlbeans-${product.version}/lib" file="build/ar/xbean.jar"/>
+
+        <mkdir dir="build/private/xmlbeans-${product.version}/src/schema"/>
+        <copy todir="build/private/xmlbeans-${product.version}/src/schema">
+            <fileset dir="src/toolschema"/>
+        </copy>
+
+        <mkdir dir="build/private/xmlbeans-${product.version}/docs"/>
+        <copy todir="build/private/xmlbeans-${product.version}/docs">
+            <fileset dir="build/docs"/>
+        </copy>
+
+        <zip destfile="build/private/incubating-xmlbeans-${product.version}.zip"
+            basedir="build/private"
+            includes="xmlbeans-${product.version}/**"/>
+        <tar destfile="build/private/incubating-xmlbeans-${product.version}.tgz"
+            basedir="build/private"
+            includes="xmlbeans-${product.version}/**"
+            compression="gzip"/>
+    </target>
+
+    <target name="dist-src" depends="clean, dirs">
+        <delete file="build/private/incubating-xmlbeans-${product.version}-src.zip"/>
+        <delete file="build/private/incubating-xmlbeans-${product.version}-src.tgz"/>
+
+        <zip destfile="build/private/incubating-xmlbeans-${product.version}-src.zip">
+            <zipfileset
+                dir="."
+                includes="**"
+                excludes="build/**"
+                prefix="xmlbeans-${product.version}"/>
+        </zip>
+        <tar destfile="build/private/incubating-xmlbeans-${product.version}-src.tgz"
+            compression="gzip">
+            <tarfileset
+                dir="."
+                includes="**"
+                excludes="build/**"
+                prefix="xmlbeans-${product.version}"/>
+        </tar>
+    </target>
+
+    <target name="enum-support.jar"
         depends="dirs, xmlpublic.classes, typeimpl.classes">
-    <jar jarfile="build/lib/enum-support.jar" index="false">
-      <fileset dir="build/classes/typeimpl/">
-        <include name="org/apache/xmlbeans/impl/values/XmlListImpl.class"/>
-        <include name="org/apache/xmlbeans/impl/values/XmlObjectBase.class"/>
-        <include name="org/apache/xmlbeans/impl/util/XsTypeConverter.class"/>
-      </fileset>
-      <fileset dir="build/classes/xmlpublic/">
-        <include name="org/apache/xmlbeans/XmlCalendar.class"/>
-      </fileset>
-    </jar>
-  </target>
+        <jar jarfile="build/lib/enum-support.jar" index="false">
+            <fileset dir="build/classes/typeimpl/">
+                <include name="org/apache/xmlbeans/impl/values/XmlListImpl.class"/>
+                <include name="org/apache/xmlbeans/impl/values/XmlObjectBase.class"/>
+                <include name="org/apache/xmlbeans/impl/util/XsTypeConverter.class"/>
+            </fileset>
+            <fileset dir="build/classes/xmlpublic/">
+                <include name="org/apache/xmlbeans/XmlCalendar.class"/>
+            </fileset>
+        </jar>
+    </target>
 
-  <!-- previously in xbean.xml -->
+    <!-- previously in xbean.xml -->
 
-  <target name="xbean.jar"
+    <target name="xbean.jar"
         depends="dirs, xmlpublic.classes, typeholder.template, typestore.classes, common.classes,
                  typeimpl.classes, xmlcomp.classes,
                  newstore2.classes, saaj_api.classes,
                  marshal.classes, xpath.classes, oldxbean.jar, xsdschema.classes,
                  xmlinputstream.classes, resolver.jar, xbean_xpath.jar,
                  piccolo.classes, tools.classes">
-    <jar jarfile="build/lib/xbean.jar" index="true">
-      <fileset dir="build/classes/xmlpublic"/>
-      <fileset dir="build/classes/typeholder"/>
-      <fileset dir="build/classes/typestore"/>
-      <fileset dir="build/classes/common"/>
-      <fileset dir="build/classes/typeimpl"/>
-      <fileset dir="build/classes/xmlcomp"/>
-      <fileset dir="build/classes/configschema"/>
-      <fileset dir="build/classes/toolschema"/>
-      <fileset dir="build/classes/xsdschema"/>
-      <fileset dir="build/classes/xmlschema"/>
-      <fileset dir="build/classes/newstore2"/>
-      <fileset dir="build/classes/saaj_api"/>
-      <fileset dir="build/classes/xmlinputstream"/>
-      <fileset dir="build/classes/marshal"/>
-      <fileset dir="build/classes/repackage"/>
-      <fileset dir="${jam_classes_dir}"/>
-      <fileset dir="build/classes/piccolo"/>
-      <fileset dir="build/classes/tools"/>
-      <fileset dir="src/license"/>
-      <manifest>
-        <section name="${manifest.name}">
-          <attribute name="Comment" value="${manifest.comment}"/>
-          <attribute name="Implementation-Title" value="${manifest.title}"/>
-          <attribute name="Implementation-Version" value="${product.version}"/>
-          <attribute name="Implementation-Vendor" value="${manifest.vendor}"/>
-          <attribute name="Implementation-URL" value="${manifest.url}"/>
-        </section>
-      </manifest>
-    </jar>
-  </target>
-
-  <!-- build XMLInputStream interface ============================================= -->
-
-  <target name="xmlinputstream.classes" depends="dirs">
-    <mkdir dir="build/classes/xmlinputstream"/>
-    <javac srcdir="src/xmlinputstream"
-        source="${javac.source}" target="${javac.target}"
-        destdir="build/classes/xmlinputstream"
-        debug="on"/>
-  </target>
-
-  <!-- xmlpublic target ============================================== -->
-
-  <target name="xmlpublic.classes" depends="dirs, xmlinputstream.classes, jsr173_api.jar">
-    <mkdir dir="build/classes/xmlpublic"/>
-    <javac srcdir="src/xmlpublic" destdir="build/classes/xmlpublic" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
-        <pathelement location="build/classes/xmlinputstream"/>
-        <pathelement location="build/lib/jsr173_api.jar"/>
-      </classpath>
-    </javac>
+        <jar jarfile="build/lib/xbean.jar" index="true">
+            <fileset dir="build/classes/xmlpublic"/>
+            <fileset dir="build/classes/typeholder"/>
+            <fileset dir="build/classes/typestore"/>
+            <fileset dir="build/classes/common"/>
+            <fileset dir="build/classes/typeimpl"/>
+            <fileset dir="build/classes/xmlcomp"/>
+            <fileset dir="build/classes/configschema"/>
+            <fileset dir="build/classes/toolschema"/>
+            <fileset dir="build/classes/xsdschema"/>
+            <fileset dir="build/classes/xmlschema"/>
+            <fileset dir="build/classes/newstore2"/>
+            <fileset dir="build/classes/saaj_api"/>
+            <fileset dir="build/classes/xmlinputstream"/>
+            <fileset dir="build/classes/marshal"/>
+            <fileset dir="build/classes/repackage"/>
+            <fileset dir="${jam_classes_dir}"/>
+            <fileset dir="build/classes/piccolo"/>
+            <fileset dir="build/classes/tools"/>
+            <fileset dir="src/license"/>
+            <manifest>
+                <section name="${manifest.name}">
+                    <attribute name="Comment" value="${manifest.comment}"/>
+                    <attribute name="Implementation-Title" value="${manifest.title}"/>
+                    <attribute name="Implementation-Version" value="${product.version}"/>
+                    <attribute name="Implementation-Vendor" value="${manifest.vendor}"/>
+                    <attribute name="Implementation-URL" value="${manifest.url}"/>
+                </section>
+            </manifest>
+        </jar>
+    </target>
 
-    <!-- Need properties files for XmlError -->
-    <copy
-      todir="build/classes/xmlpublic">
-      <fileset dir="src/xmlpublic">
-        <include name="**/*.properties"/>
-      </fileset>
-    </copy>
-  </target>
-
-  <target name="xmlpublic.jar" depends="dirs, xmlinputstream.classes, xmlpublic.classes, xmlschema.classes, xsdschema.classes">
-    <jar jarfile="build/lib/xmlpublic.jar"  index="true">
-      <fileset dir="build/classes/xmlpublic"/>
-      <fileset dir="build/classes/xmlschema"/>
-      <fileset dir="build/classes/xsdschema"/>
-      <manifest>
-        <section name="${manifest.name}">
-          <attribute name="Comment" value="${manifest.comment}"/>
-          <attribute name="Implementation-Title" value="${manifest.title}"/>
-          <attribute name="Implementation-Version" value="${product.version}"/>
-          <attribute name="Implementation-Vendor" value="${manifest.vendor}"/>
-          <attribute name="Implementation-URL" value="${manifest.url}"/>
-        </section>
-      </manifest>
-    </jar>
-  </target>
-
-  <!-- typestore target ============================================== -->
-
-  <target name="typestore.classes" depends="dirs, xmlpublic.classes, common.classes, xmlinputstream.classes">
-    <mkdir dir="build/classes/typestore"/>
-    <javac srcdir="src/typestore" destdir="build/classes/typestore" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
-        <pathelement location="build/lib/jsr173_api.jar"/>
-        <pathelement location="build/classes/xmlinputstream"/>
-        <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/common"/>
-      </classpath>
-    </javac>
+    <!-- build XMLInputStream interface ============================================= -->
 
-  </target>
+    <target name="xmlinputstream.classes" depends="dirs">
+        <mkdir dir="build/classes/xmlinputstream"/>
+        <javac srcdir="src/xmlinputstream"
+            source="${javac.source}" target="${javac.target}"
+            destdir="build/classes/xmlinputstream"
+            debug="on"/>
+    </target>
 
-  <!-- common target ============================================= -->
+    <!-- xmlpublic target ============================================== -->
 
-  <target name="common.classes" depends="dirs, xmlpublic.jar, xmlinputstream.classes, jsr173_api.jar">
-    <mkdir dir="build/classes/common"/>
-    <javac srcdir="src/common" destdir="build/classes/common" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
-        <pathelement location="build/lib/jsr173_api.jar"/>
-        <pathelement location="build/classes/xmlinputstream"/>
-        <pathelement location="build/lib/xmlpublic.jar"/>
-      </classpath>
-    </javac>
+    <target name="xmlpublic.classes" depends="dirs, xmlinputstream.classes, jsr173_api.jar">
+        <mkdir dir="build/classes/xmlpublic"/>
+        <javac srcdir="src/xmlpublic" destdir="build/classes/xmlpublic" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+            </classpath>
+        </javac>
 
-  </target>
+        <!-- Need properties files for XmlError -->
+        <copy
+            todir="build/classes/xmlpublic">
+            <fileset dir="src/xmlpublic">
+                <include name="**/*.properties"/>
+            </fileset>
+        </copy>
+    </target>
 
-  <!-- typeholder target ================================================ -->
+    <target name="xmlpublic.jar" depends="dirs, xmlinputstream.classes, xmlpublic.classes, xmlschema.classes, xsdschema.classes">
+        <jar jarfile="build/lib/xmlpublic.jar" index="true">
+            <fileset dir="build/classes/xmlpublic"/>
+            <fileset dir="build/classes/xmlschema"/>
+            <fileset dir="build/classes/xsdschema"/>
+            <manifest>
+                <section name="${manifest.name}">
+                    <attribute name="Comment" value="${manifest.comment}"/>
+                    <attribute name="Implementation-Title" value="${manifest.title}"/>
+                    <attribute name="Implementation-Version" value="${product.version}"/>
+                    <attribute name="Implementation-Vendor" value="${manifest.vendor}"/>
+                    <attribute name="Implementation-URL" value="${manifest.url}"/>
+                </section>
+            </manifest>
+        </jar>
+    </target>
 
-  <property name="typeholder.name" value="org/apache/xmlbeans/impl/schema/TypeSystemHolder"/>
+    <!-- typestore target ============================================== -->
 
-  <target name="typeholder.check">
-    <condition property="typeholder.notRequired">
-        <uptodate property="typeholder.notRequired"
-          targetfile="build/classes/typeholder/${typeholder.name}.template">
-          <srcfiles dir="src/typeholder" includes="${typeholder.name}.java"/>
-        </uptodate>
-    </condition>
-  </target>
+    <target name="typestore.classes" depends="dirs, xmlpublic.classes, common.classes, xmlinputstream.classes">
+        <mkdir dir="build/classes/typestore"/>
+        <javac srcdir="src/typestore" destdir="build/classes/typestore" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/common"/>
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- common target ============================================= -->
+
+    <target name="common.classes" depends="dirs, xmlpublic.jar, xmlinputstream.classes, jsr173_api.jar">
+        <mkdir dir="build/classes/common"/>
+        <javac srcdir="src/common" destdir="build/classes/common" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/lib/xmlpublic.jar"/>
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- typeholder target ================================================ -->
+
+    <property name="typeholder.name" value="org/apache/xmlbeans/impl/schema/TypeSystemHolder"/>
+
+    <target name="typeholder.check">
+        <condition property="typeholder.notRequired">
+            <uptodate property="typeholder.notRequired"
+                targetfile="build/classes/typeholder/${typeholder.name}.template">
+                <srcfiles dir="src/typeholder" includes="${typeholder.name}.java"/>
+            </uptodate>
+        </condition>
+    </target>
+
+    <target name="typeholder.template" depends="typeholder.check, xmlpublic.classes" unless="typeholder.notRequired">
+        <mkdir dir="build/classes/typeholder"/>
+        <javac destdir="build/classes/typeholder" source="${javac.source}" target="${javac.target}" debug="off">
+            <classpath>
+                <pathelement location="build/classes/xmlpublic"/>
+            </classpath>
+            <src location="src/typeholder"/>
+        </javac>
+        <move
+            file="build/classes/typeholder/${typeholder.name}.class"
+            tofile="build/classes/typeholder/${typeholder.name}.template"/>
+    </target>
+
+    <!-- typeimpl target ============================================== -->
+
+    <target name="typeimpl.classes" depends="dirs, newstore2.classes,
+        repackage.classes, xmlpublic.classes, typeholder.template, typestore.classes, xsdschema.classes,
+        configschema.classes, toolschema.classes, jsr173_api.jar, jam">
+        <mkdir dir="build/classes/typeimpl"/>
+        <javac destdir="build/classes/typeimpl" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/classes/newstore2"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/common"/>
+                <pathelement location="build/classes/repackage"/>
+                <pathelement location="build/classes/typestore"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/xmlconfig"/>
+                <pathelement location="build/classes/configschema"/>
+                <pathelement location="build/classes/xsdschema"/>
+                <pathelement location="build/classes/xmlschema"/>
+                <pathelement location="build/classes/toolschema"/>
+                <pathelement location="${jam_classes_dir}"/>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+            </classpath>
+
+            <src path="src/typeimpl"/>
+            <src path="build/src/xmlschema"/>
+            <src path="build/src/xsdschema"/>
+            <src path="build/src/configschema"/>
+            <src path="build/src/toolschema"/>
+            <src path="src/xmlconfig"/>
+        </javac>
+
+        <!-- Need properties files for regex -->
+        <copy
+            todir="build/classes/typeimpl">
+            <fileset dir="src/typeimpl">
+                <exclude name="**/*.java"/>
+            </fileset>
+        </copy>
+    </target>
+
+    <!-- xmlcomp target =============================================== -->
+
+    <target name="xmlcomp.classes" depends="dirs, repackage.classes, typeimpl.classes, xmlpublic.classes, typestore.classes">
+        <mkdir dir="build/classes/xmlcomp"/>
+        <javac srcdir="src/xmlcomp" destdir="build/classes/xmlcomp" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/common"/>
+                <pathelement location="build/classes/repackage"/>
+                <pathelement location="build/classes/typeimpl"/>
+                <pathelement location="build/classes/xmlconfig"/>
+                <pathelement location="build/classes/configschema"/>
+                <pathelement location="build/classes/toolschema"/>
+                <pathelement location="build/classes/xsdschema"/>
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- jam target =================================================== -->
+
+    <target name='jam'>
+        <ant dir='${jam_root}' target='all' inheritAll='false'/>
+    </target>
+
+    <!-- marshal target =============================================== -->
+
+    <target name="marshal.classes" depends="dirs, typeimpl.classes, xmlpublic.classes, jsr173_api.jar">
+        <mkdir dir="build/classes/marshal"/>
+        <javac srcdir="src/marshal" destdir="build/classes/marshal" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/configschema"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/common"/>
+                <pathelement location="build/classes/typeimpl"/>
+                <pathelement location="build/classes/newstore2"/>
+            </classpath>
+        </javac>
+    </target>
 
-  <target name="typeholder.template" depends="typeholder.check, xmlpublic.classes" unless="typeholder.notRequired">
-    <mkdir dir="build/classes/typeholder"/>
-    <javac destdir="build/classes/typeholder" source="${javac.source}" target="${javac.target}" debug="off">
-      <classpath>
-        <pathelement location="build/classes/xmlpublic"/>
-      </classpath>
-      <src location="src/typeholder"/>
-    </javac>
-    <move
-      file="build/classes/typeholder/${typeholder.name}.class"
-      tofile="build/classes/typeholder/${typeholder.name}.template"/>
-  </target>
-
-  <!-- typeimpl target ============================================== -->
-
-  <target name="typeimpl.classes" depends="dirs, newstore2.classes,
-      repackage.classes, xmlpublic.classes, typeholder.template, typestore.classes, xsdschema.classes,
-      configschema.classes, toolschema.classes, jsr173_api.jar, jam">
-    <mkdir dir="build/classes/typeimpl"/>
-    <javac destdir="build/classes/typeimpl" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
-        <pathelement location="build/classes/newstore2"/>
-        <pathelement location="build/classes/xmlinputstream"/>
-        <pathelement location="build/classes/common"/>
-        <pathelement location="build/classes/repackage"/>
-        <pathelement location="build/classes/typestore"/>
-        <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/xmlconfig"/>
-        <pathelement location="build/classes/configschema"/>
-        <pathelement location="build/classes/xsdschema"/>
-        <pathelement location="build/classes/xmlschema"/>
-        <pathelement location="build/classes/toolschema"/>
-        <pathelement location="${jam_classes_dir}"/>
-        <pathelement location="build/lib/jsr173_api.jar"/>
-      </classpath>
 
-        <src path="src/typeimpl"/>
-        <src path="build/src/xmlschema"/>
-        <src path="build/src/xsdschema"/>
-        <src path="build/src/configschema"/>
-        <src path="build/src/toolschema"/>
-        <src path="src/xmlconfig"/>
-    </javac>
-
-    <!-- Need properties files for regex -->
-    <copy
-      todir="build/classes/typeimpl">
-      <fileset dir="src/typeimpl">
-        <exclude name="**/*.java"/>
-      </fileset>
-    </copy>
-  </target>
-
-  <!-- xmlcomp target =============================================== -->
-
-  <target name="xmlcomp.classes" depends="dirs, repackage.classes, typeimpl.classes, xmlpublic.classes, typestore.classes">
-    <mkdir dir="build/classes/xmlcomp"/>
-    <javac srcdir="src/xmlcomp" destdir="build/classes/xmlcomp" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
+    <!-- saaj_api target ============================================== -->
+
+    <target name="saaj_api.classes" depends="dirs">
+        <mkdir dir="build/classes/saaj_api"/>
+        <javac srcdir="src/saaj_api" destdir="build/classes/saaj_api" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath id="saaj_api.compile.path">
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- newstore2 target ============================================== -->
+
+    <target name="newstore2.classes"
+        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, saaj_api.classes, piccolo.classes">
+        <mkdir dir="build/classes/newstore2"/>
+        <javac srcdir="src/newstore2" destdir="build/classes/newstore2" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath id="newstore2.compile.path">
+                <pathelement location="build/classes/typestore"/>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/common"/>
+                <pathelement location="build/classes/saaj_api"/>
+                <pathelement location="build/classes/piccolo"/>
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- tools target ============================================== -->
+
+    <target name="tools.classes"
+        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, saaj_api.classes, piccolo.classes,
+        typeimpl.classes, xmlcomp.classes">
+        <mkdir dir="build/classes/tools"/>
+        <javac srcdir="src/tools" destdir="build/classes/tools" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath id="tools.compile.path">
+                <pathelement location="build/classes/typestore"/>
+                <pathelement location="build/lib/jsr173_api.jar"/>
+                <pathelement location="build/classes/xmlinputstream"/>
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/common"/>
+                <pathelement location="build/classes/saaj_api"/>
+                <pathelement location="build/classes/piccolo"/>
+                <pathelement location="build/classes/typeimpl"/>
+                <pathelement location="build/classes/xmlcomp"/>
+            </classpath>
+        </javac>
+
+    </target>
+
+    <!-- bootstrap schema target support ================================ -->
+
+
+    <!-- xsdschema target =============================================== -->
+
+    <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+    <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+    <path id="bootstrap.run.path">
+        <pathelement location="build/private/lib/oldxbean.jar"/>
         <pathelement location="build/lib/jsr173_api.jar"/>
-        <pathelement location="build/classes/xmlinputstream"/>
+    </path>
+
+    <path id="bootstrap.compile.path">
         <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/common"/>
-        <pathelement location="build/classes/repackage"/>
-        <pathelement location="build/classes/typeimpl"/>
-        <pathelement location="build/classes/xmlconfig"/>
-        <pathelement location="build/classes/configschema"/>
-        <pathelement location="build/classes/toolschema"/>
-        <pathelement location="build/classes/xsdschema"/>
-      </classpath>
-    </javac>
-
-  </target>
-
-  <!-- jam target =================================================== -->
-
-  <target name='jam'>
-    <ant dir='${jam_root}' target='all' inheritAll='false'/>
-  </target>
-
-  <!-- marshal target =============================================== -->
-
-  <target name="marshal.classes" depends="dirs, typeimpl.classes, xmlpublic.classes, jsr173_api.jar">
-    <mkdir dir="build/classes/marshal"/>
-    <javac srcdir="src/marshal" destdir="build/classes/marshal" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
         <pathelement location="build/lib/jsr173_api.jar"/>
-        <pathelement location="build/classes/configschema"/>
-        <pathelement location="build/classes/xmlinputstream"/>
+    </path>
+
+    <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
+
+    <path id="xsdschema.compile.path">
+        <pathelement location="build/classes/xmlschema"/>
         <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/common"/>
-        <pathelement location="build/classes/typeimpl"/>
-        <pathelement location="build/classes/newstore2"/>
-      </classpath>
-    </javac>
-  </target>
+    </path>
 
+    <property name="xsdschema.compile.path" refid="xsdschema.compile.path"/>
 
-  <!-- saaj_api target ============================================== -->
+    <target name="xsdschema.check">
+        <condition property="xsdschema.notRequired">
+            <uptodate property="xsdschema.notRequired" targetfile="build/classes/xsdschema/schema/system/sXMLSCHEMA/index.xsb">
+                <srcfiles dir="src/xsdschema" includes="**/*.xsd"/>
+            </uptodate>
+        </condition>
+    </target>
 
-  <target name="saaj_api.classes" depends="dirs">
-    <mkdir dir="build/classes/saaj_api"/>
-    <javac srcdir="src/saaj_api" destdir="build/classes/saaj_api" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath id="saaj_api.compile.path">
-      </classpath>
-    </javac>
+    <target name="xsdschema.classes" depends="xsdschema.check, xmlschema.classes, xmlpublic.classes, oldxbean.jar" unless="xsdschema.notRequired">
+        <delete dir="build/classes/xsdschema"/>
+        <delete dir="build/src/xsdschema"/>
+        <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+            <jvmarg value="-ea"/>
+            <arg line="${repackage_arg} -name sXMLSCHEMA  -srconly -d build/classes/xsdschema -noann -src build/src/xsdschema src/xsdschema/schema"/>
+        </java>
+    </target>
 
-  </target>
+    <!-- xmlschema target ============================================= -->
 
-  <!-- newstore2 target ============================================== -->
+    <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+    <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
 
-  <target name="newstore2.classes"
-        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, saaj_api.classes, piccolo.classes">
-    <mkdir dir="build/classes/newstore2"/>
-    <javac srcdir="src/newstore2" destdir="build/classes/newstore2" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath id="newstore2.compile.path">
-        <pathelement location="build/classes/typestore"/>
-        <pathelement location="build/lib/jsr173_api.jar"/>
-        <pathelement location="build/classes/xmlinputstream"/>
-        <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/common"/>
-        <pathelement location="build/classes/saaj_api"/>
-        <pathelement location="build/classes/piccolo"/>
-      </classpath>
-    </javac>
+    <target name="xmlschema.check">
+        <condition property="xmlschema.notRequired">
+            <uptodate property="xmlschema.notRequired" targetfile="build/classes/xmlschema/schema/system/sXMLLANG/index.xsb">
+                <srcfiles dir="src/xmlschema" includes="**/*.xsd"/>
+            </uptodate>
+        </condition>
+    </target>
 
-  </target>
+    <target name="xmlschema.classes" depends="xmlschema.check, xmlpublic.classes, oldxbean.jar, jsr173_api.jar" unless="xmlschema.notRequired">
+        <delete dir="build/classes/xmlschema"/>
+        <delete dir="build/src/xmlschema"/>
+        <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+            <jvmarg value="-ea"/>
+            <arg line="${repackage_arg} -name sXMLLANG -noann -d build/classes/xmlschema -src build/src/xmlschema -srconly src/xmlschema/schema"/>
+        </java>
+    </target>
 
-    <!-- tools target ============================================== -->
+    <!-- xmlconfig target =============================================== -->
 
-    <target name="tools.classes"
-          depends="dirs, common.classes, xmlpublic.classes, typestore.classes, saaj_api.classes, piccolo.classes,
-          typeimpl.classes, xmlcomp.classes">
-      <mkdir dir="build/classes/tools"/>
-      <javac srcdir="src/tools" destdir="build/classes/tools" source="${javac.source}" target="${javac.target}" debug="on">
-        <classpath id="tools.compile.path">
-          <pathelement location="build/classes/typestore"/>
-          <pathelement location="build/lib/jsr173_api.jar"/>
-          <pathelement location="build/classes/xmlinputstream"/>
-          <pathelement location="build/classes/xmlpublic"/>
-          <pathelement location="build/classes/common"/>
-          <pathelement location="build/classes/saaj_api"/>
-          <pathelement location="build/classes/piccolo"/>
-          <pathelement location="build/classes/typeimpl"/>
-          <pathelement location="build/classes/xmlcomp"/>
-        </classpath>
-      </javac>
+    <target name="xmlconfig.classes" depends="dirs, xmlpublic.jar, configschema.classes">
+        <mkdir dir="build/classes/xmlconfig"/>
+        <javac srcdir="src/xmlconfig" destdir="build/classes/xmlconfig" source="${javac.source}" target="${javac.target}" debug="on">
+            <classpath>
+                <pathelement location="build/lib/xmlpublic.jar"/>
+                <pathelement location="build/classes/configschema"/>
+            </classpath>
+        </javac>
 
     </target>
 
-  <!-- bootstrap schema target support ================================ -->
-
-
-  <!-- xsdschema target =============================================== -->
-
-  <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
-  <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
-
-  <path id="bootstrap.run.path">
-    <pathelement location="build/private/lib/oldxbean.jar"/>
-    <pathelement location="build/lib/jsr173_api.jar"/>
-  </path>
-
-  <path id="bootstrap.compile.path">
-    <pathelement location="build/classes/xmlpublic"/>
-    <pathelement location="build/lib/jsr173_api.jar"/>
-  </path>
-
-  <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
-
-  <path id="xsdschema.compile.path">
-    <pathelement location="build/classes/xmlschema"/>
-    <pathelement location="build/classes/xmlpublic"/>
-  </path>
-
-  <property name="xsdschema.compile.path" refid="xsdschema.compile.path"/>
-
-  <target name="xsdschema.check">
-    <condition property="xsdschema.notRequired">
-        <uptodate property="xsdschema.notRequired" targetfile="build/classes/xsdschema/schema/system/sXMLSCHEMA/index.xsb">
-          <srcfiles dir="src/xsdschema" includes="**/*.xsd"/>
+    <!-- configschema target ============================================= -->
+
+    <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+    <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+    <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
+
+    <target name="configschema.check">
+        <uptodate property="configschema.notRequired" targetfile="build/classes/configschema/schema/system/sXMLCONFIG/index.xsb">
+            <srcfiles dir="src/configschema" includes="**/*.xsd"/>
         </uptodate>
-    </condition>
-  </target>
+    </target>
+
+    <target name="configschema.classes" depends="configschema.check, xmlpublic.classes, oldxbean.jar" unless="configschema.notRequired">
+        <delete dir="build/classes/configschema"/>
+        <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+            <jvmarg value="-ea"/>
+            <arg line="${repackage_arg} -name sXMLCONFIG -srconly -noann -src build/src/configschema -d build/classes/configschema src/configschema/schema"/>
+        </java>
+    </target>
+
+    <!-- toolschema target ============================================= -->
+
+    <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+    <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+    <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
 
-  <target name="xsdschema.classes" depends="xsdschema.check, xmlschema.classes, xmlpublic.classes, oldxbean.jar" unless="xsdschema.notRequired">
-    <delete dir="build/classes/xsdschema"/>
-    <delete dir="build/src/xsdschema"/>
-    <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
-      <jvmarg value="-ea"/>
-      <arg line="${repackage_arg} -name sXMLSCHEMA  -srconly -d build/classes/xsdschema -noann -src build/src/xsdschema src/xsdschema/schema"/>
-    </java>
-  </target>
-
-  <!-- xmlschema target ============================================= -->
-
-  <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
-  <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
-
-  <target name="xmlschema.check">
-    <condition property="xmlschema.notRequired">
-        <uptodate property="xmlschema.notRequired" targetfile="build/classes/xmlschema/schema/system/sXMLLANG/index.xsb">
-          <srcfiles dir="src/xmlschema" includes="**/*.xsd"/>
+    <target name="toolschema.check">
+        <uptodate property="toolschema.notRequired" targetfile="build/classes/toolschema/schema/system/sXMLTOOLS/index.xsb">
+            <srcfiles dir="src/toolschema" includes="**/*.xsd"/>
         </uptodate>
-    </condition>
-  </target>
+    </target>
 
-  <target name="xmlschema.classes" depends="xmlschema.check, xmlpublic.classes, oldxbean.jar, jsr173_api.jar" unless="xmlschema.notRequired">
-    <delete dir="build/classes/xmlschema"/>
-    <delete dir="build/src/xmlschema"/>
-    <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
-      <jvmarg value="-ea"/>
-      <arg line="${repackage_arg} -name sXMLLANG -noann -d build/classes/xmlschema -src build/src/xmlschema -srconly src/xmlschema/schema"/>
-    </java>
-  </target>
-
-  <!-- xmlconfig target =============================================== -->
-
-  <target name="xmlconfig.classes" depends="dirs, xmlpublic.jar, configschema.classes">
-    <mkdir dir="build/classes/xmlconfig"/>
-    <javac srcdir="src/xmlconfig" destdir="build/classes/xmlconfig" source="${javac.source}" target="${javac.target}" debug="on">
-      <classpath>
-        <pathelement location="build/lib/xmlpublic.jar"/>
-        <pathelement location="build/classes/configschema"/>
-      </classpath>
-    </javac>
-
-  </target>
-
-  <!-- configschema target ============================================= -->
-
-  <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
-  <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
-
-  <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
-
-  <target name="configschema.check">
-    <uptodate property="configschema.notRequired" targetfile="build/classes/configschema/schema/system/sXMLCONFIG/index.xsb">
-      <srcfiles dir="src/configschema" includes="**/*.xsd"/>
-    </uptodate>
-  </target>
-
-  <target name="configschema.classes" depends="configschema.check, xmlpublic.classes, oldxbean.jar" unless="configschema.notRequired">
-    <delete dir="build/classes/configschema"/>
-    <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
-      <jvmarg value="-ea"/>
-      <arg line="${repackage_arg} -name sXMLCONFIG -srconly -noann -src build/src/configschema -d build/classes/configschema src/configschema/schema"/>
-    </java>
-  </target>
-
-  <!-- toolschema target ============================================= -->
-
-  <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
-  <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
-
-  <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
-
-  <target name="toolschema.check">
-    <uptodate property="toolschema.notRequired" targetfile="build/classes/toolschema/schema/system/sXMLTOOLS/index.xsb">
-      <srcfiles dir="src/toolschema" includes="**/*.xsd"/>
-    </uptodate>
-  </target>
-
-  <target name="toolschema.classes" depends="toolschema.check, xmlpublic.classes, oldxbean.jar" unless="toolschema.notRequired">
-    <delete dir="build/classes/toolschema"/>
-    <mkdir dir="build/src/toolschema"/>
-    <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
-      <jvmarg value="-ea"/>
-      <arg line="${repackage_arg} -name sXMLTOOLS -srconly -noann -src build/src/toolschema -d build/classes/toolschema src/toolschema"/>
-    </java>
-  </target>
+    <target name="toolschema.classes" depends="toolschema.check, xmlpublic.classes, oldxbean.jar" unless="toolschema.notRequired">
+        <delete dir="build/classes/toolschema"/>
+        <mkdir dir="build/src/toolschema"/>
+        <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+            <jvmarg value="-ea"/>
+            <arg line="${repackage_arg} -name sXMLTOOLS -srconly -noann -src build/src/toolschema -d build/classes/toolschema src/toolschema"/>
+        </java>
+    </target>
 
 
     <!-- =========================== -->
@@ -772,170 +791,169 @@
         <javac srcdir="src/repackage" destdir="build/classes/repackage" source="${javac.source}" target="${javac.target}" debug="on"/>
     </target>
 
-  <!-- xpath target ============================================= -->
+    <!-- xpath target ============================================= -->
 
-  <target name="xpath.classes" depends="dirs, xmlpublic.jar, newstore2.classes">
-    <mkdir dir="build/classes/xpath"/>
-    <javac
-       srcdir="src/xpath"
-       destdir="build/classes/xpath"
-       classpathref="xpath.compile.path"
-       source="${javac.source}" target="${javac.target}"
-       debug="on">
-      <classpath id="xpath.compile.path">
-        <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/classes/newstore2"/>
-        <pathelement location="external/lib/jaxen-1.1-beta-2.jar"/>
-      </classpath>
-    </javac>
-  </target>
-
-  <target name="xbean_xpath.jar" depends="dirs, xpath.classes, expand.jaxen">
-    <jar jarfile="build/lib/xbean_xpath.jar" basedir="build/classes/xpath"/>
-  </target>
-
-  <target name="expand.jaxen" depends="check.expand.jaxen" unless="expand.jaxen.notRequired">
-    <unjar src="external/lib/jaxen-1.1-beta-2.jar" dest="build/classes/xpath" />
-  </target>
-
-  <target name="check.expand.jaxen">
-    <available property="expand.jaxen.notRequired"
-      file="build/classes/xpath/org/jaxen/XPath.class"/>
-  </target>
-
-  <!-- TEST Targets ===================================================== -->
-  <!-- All targets hook up into testbuild.xml -->
-  <property name="testbuild.file" value="testbuild.xml"/>
-
-  <target name="testbuild">
-    <ant antfile="${testbuild.file}" target="build"/>
-  </target>
-
-  <target name="build.tools">
-    <ant antfile="${testbuild.file}" target="build.test.tools"/>
-  </target>
-
-  <target name="build.schemas">
-    <ant antfile="${testbuild.file}" target="build.schemas"/>
-  </target>
-
-  <target name="build.tests">
-    <ant antfile="${testbuild.file}" target="build.tests"/>
-  </target>
-
-  <target name="testclean">
-    <ant antfile="${testbuild.file}" target="clean"/>
-  </target>
-
-  <target name="clean.schemas">
-    <ant antfile="${testbuild.file}" target="clean.schemas"/>
-  </target>
-
-  <target name="clean.tests">
-    <ant antfile="${testbuild.file}" target="clean.tests"/>
-  </target>
-
-  <target name="clean.cc">
-    <ant antfile="${testbuild.file}" target="clean.cc"/>
-  </target>
-
-  <target name="run.junit">
-    <ant antfile="${testbuild.file}" target="run.junit"/>
-  </target>
-
-  <target name="checkintest">
-    <ant antfile="${testbuild.file}" target="checkin"/>
-  </target>
-
-  <target name="detailed">
-    <ant antfile="${testbuild.file}" target="detailed"/>
-  </target>
-
-
-
-   <path id="test.compile.path">
-    <pathelement location="build/classes/marshal"/>
-    <pathelement location="build/classes/common"/>
-       <pathelement location="external/lib/junit.jar"/>
-       <pathelement location="build/ar/xbean.jar"/>
-       <pathelement location="build/lib/jsr173_api.jar"/>
-       <pathelement location="build/classes/xmlinputstream"/>
-     </path>
-
-     <path id="test.run.path">
-       <pathelement location="build/ar/xbean.jar"/>
-       <pathelement location="external/lib/junit.jar"/>
-  </path>
-
-
-   <target name="drt.classes" depends="dirs,jsr173_ri.jar">
-       <mkdir dir="build/private/classes/drt"/>
-       <javac
-          destdir="build/private/classes/drt"
-          classpathref="test.compile.path"
-          source="${javac.source}" target="${javac.target}"
-          debug="on">
-         <src path="test/src/drt"/>
-      </javac>
-     </target>
-
-     <target name="drt.jar" depends="drt.classes">
-       <jar jarfile="build/private/lib/drt.jar" basedir="build/private/classes/drt"/>
-  </target>
-
-
-  <!-- stsschema (for testing) target ================================ -->
-
-  <path id="scomp.run.path">
-    <pathelement location="build/lib/xbean.jar"/>
-    <pathelement location="build/lib/jsr173_api.jar"/>
-  </path>
-
-  <target name="stsschema.check">
-    <uptodate property="stsschema.notRequired" targetfile="build/private/lib/stsschema.jar">
-      <srcfiles dir="test/src/stsschema" includes="**/*.xsd"/>
-      <srcfiles dir="build/ar" includes="xbean.jar"/>
-    </uptodate>
-  </target>
-
-  <target name="stsschema.jar" depends="stsschema.check, dirs, xbean" unless="stsschema.notRequired">
-    <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
-      <jvmarg value="-ea"/>
-      <arg line="-out build/private/lib/stsschema.jar test/src/stsschema"/>
-    </java>
-  </target>
-
-  <!-- Piccolo deployment -->
-  <target name="piccolo.classes.check">
-    <uptodate property="piccolo.classes.notRequired"
-        targetfile="build/ar/xbean.jar" >
-      <srcfiles dir="external/lib" includes="**/piccolo_*.jar"/>
-    </uptodate>
-  </target>
-
-  <target name="piccolo.classes" depends="piccolo.classes.check, dirs, repackage.classes" unless="piccolo.classes.notRequired">
-    <delete dir="build/private/piccolo" />
-    <mkdir dir="build/private/piccolo" />
-    <unjar src="external/lib/piccolo_apache_dist_20040629_v2.jar" dest="build/private/piccolo" />
-
-    <echo message="Re-packaging XmlBeans" />
-
-    <java classname="repackage.Repackage" fork="true" failonerror="true">
-        <classpath>
-            <pathelement location="build/classes/repackage"/>
-        </classpath>
-        <arg line="-repackage com.bluecast:${piccolo_package_name} -f build/private/piccolo/src -t build/private/piccolo/src_repackage"/>
-    </java>
-
-    <delete dir="build/classes/piccolo" />
-    <mkdir dir="build/classes/piccolo" />
-    <javac
-          destdir="build/classes/piccolo"
-          classpath=""
-          source="1.3" target="1.4"
-          debug="on" >
-         <src path="build/private/piccolo/src_repackage"/>
-    </javac>
-  </target>
+    <target name="xpath.classes" depends="dirs, xmlpublic.jar, newstore2.classes, saxon8.2.jar">
+        <mkdir dir="build/classes/xpath_xquery"/>
+        <javac
+            destdir="build/classes/xpath_xquery"
+            classpathref="xpath.compile.path"
+            source="${javac.source}" target="${javac.target}"
+            debug="on">
+            <src path="src/xpath_xquery"/>
+            <classpath id="xpath.compile.path">
+                <pathelement location="build/classes/xmlpublic"/>
+                <pathelement location="build/classes/newstore2"/>
+                <pathelement location="build/lib/saxon8.jar"/>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="xbean_xpath.jar" depends="dirs, xpath.classes">
+        <jar jarfile="build/lib/xbean_xpath.jar" basedir="build/classes/xpath_xquery"/>
+    </target>
+    <!--
+       <target name="expand.jaxen" depends="check.expand.jaxen" unless="expand.jaxen.notRequired">
+           <unjar src="external/lib/jaxen-1.1-beta-2.jar" dest="build/classes/xpath"/>
+       </target>
+
+       <target name="check.expand.jaxen">
+           <available property="expand.jaxen.notRequired"
+               file="build/classes/xpath/org/jaxen/XPath.class"/>
+       </target>
+       -->
+    <!-- TEST Targets ===================================================== -->
+    <!-- All targets hook up into testbuild.xml -->
+    <property name="testbuild.file" value="testbuild.xml"/>
+
+    <target name="testbuild">
+        <ant antfile="${testbuild.file}" target="build"/>
+    </target>
+
+    <target name="build.tools">
+        <ant antfile="${testbuild.file}" target="build.test.tools"/>
+    </target>
+
+    <target name="build.schemas">
+        <ant antfile="${testbuild.file}" target="build.schemas"/>
+    </target>
+
+    <target name="build.tests">
+        <ant antfile="${testbuild.file}" target="build.tests"/>
+    </target>
+
+    <target name="testclean">
+        <ant antfile="${testbuild.file}" target="clean"/>
+    </target>
+
+    <target name="clean.schemas">
+        <ant antfile="${testbuild.file}" target="clean.schemas"/>
+    </target>
+
+    <target name="clean.tests">
+        <ant antfile="${testbuild.file}" target="clean.tests"/>
+    </target>
+
+    <target name="clean.cc">
+        <ant antfile="${testbuild.file}" target="clean.cc"/>
+    </target>
+
+    <target name="run.junit">
+        <ant antfile="${testbuild.file}" target="run.junit"/>
+    </target>
+
+    <target name="checkintest">
+        <ant antfile="${testbuild.file}" target="checkin"/>
+    </target>
+
+    <target name="detailed">
+        <ant antfile="${testbuild.file}" target="detailed"/>
+    </target>
+
+
+    <path id="test.compile.path">
+        <pathelement location="build/classes/marshal"/>
+        <pathelement location="build/classes/common"/>
+        <pathelement location="external/lib/junit.jar"/>
+        <pathelement location="build/ar/xbean.jar"/>
+        <pathelement location="build/lib/jsr173_api.jar"/>
+        <pathelement location="build/classes/xmlinputstream"/>
+    </path>
+
+    <path id="test.run.path">
+        <pathelement location="build/ar/xbean.jar"/>
+        <pathelement location="external/lib/junit.jar"/>
+    </path>
+
+
+    <target name="drt.classes" depends="dirs,jsr173_ri.jar">
+        <mkdir dir="build/private/classes/drt"/>
+        <javac
+            destdir="build/private/classes/drt"
+            classpathref="test.compile.path"
+            source="${javac.source}" target="${javac.target}"
+            debug="on">
+            <src path="test/src/drt"/>
+        </javac>
+    </target>
+
+    <target name="drt.jar" depends="drt.classes">
+        <jar jarfile="build/private/lib/drt.jar" basedir="build/private/classes/drt"/>
+    </target>
+
+
+    <!-- stsschema (for testing) target ================================ -->
+
+    <path id="scomp.run.path">
+        <pathelement location="build/lib/xbean.jar"/>
+        <pathelement location="build/lib/jsr173_api.jar"/>
+    </path>
+
+    <target name="stsschema.check">
+        <uptodate property="stsschema.notRequired" targetfile="build/private/lib/stsschema.jar">
+            <srcfiles dir="test/src/stsschema" includes="**/*.xsd"/>
+            <srcfiles dir="build/ar" includes="xbean.jar"/>
+        </uptodate>
+    </target>
+
+    <target name="stsschema.jar" depends="stsschema.check, dirs, xbean" unless="stsschema.notRequired">
+        <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+            <jvmarg value="-ea"/>
+            <arg line="-out build/private/lib/stsschema.jar test/src/stsschema"/>
+        </java>
+    </target>
+
+    <!-- Piccolo deployment -->
+    <target name="piccolo.classes.check">
+        <uptodate property="piccolo.classes.notRequired"
+            targetfile="build/ar/xbean.jar">
+            <srcfiles dir="external/lib" includes="**/piccolo_*.jar"/>
+        </uptodate>
+    </target>
+
+    <target name="piccolo.classes" depends="piccolo.classes.check, dirs, repackage.classes" unless="piccolo.classes.notRequired">
+        <delete dir="build/private/piccolo"/>
+        <mkdir dir="build/private/piccolo"/>
+        <unjar src="external/lib/piccolo_apache_dist_20040629_v2.jar" dest="build/private/piccolo"/>
+
+        <echo message="Re-packaging XmlBeans"/>
+
+        <java classname="repackage.Repackage" fork="true" failonerror="true">
+            <classpath>
+                <pathelement location="build/classes/repackage"/>
+            </classpath>
+            <arg line="-repackage com.bluecast:${piccolo_package_name} -f build/private/piccolo/src -t build/private/piccolo/src_repackage"/>
+        </java>
+
+        <delete dir="build/classes/piccolo"/>
+        <mkdir dir="build/classes/piccolo"/>
+        <javac
+            destdir="build/classes/piccolo"
+            classpath=""
+            source="1.3" target="1.4"
+            debug="on">
+            <src path="build/private/piccolo/src_repackage"/>
+        </javac>
+    </target>
 
 </project>

Modified: xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java&r1=125212&p2=xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java	(original)
+++ xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/XPath.java	Fri Jan 14 13:48:30 2005
@@ -25,6 +25,7 @@
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.impl.common.XMLChar;
 
+
 public class XPath
 {
     public static class XPathCompileException extends XmlException
@@ -482,12 +483,12 @@
             return true;
         }
 
-        private boolean tokenize ( String s1, String s2, String s3 )
+        private boolean tokenize ( String s1, String s2, String s3)
         {
             assert s1.length() > 0;
             assert s2.length() > 0;
             assert s3.length() > 0;
-            
+
             int offset = 0;
 
             while ( isWhitespace( offset ) )
@@ -513,11 +514,60 @@
                 return false;
             
             offset += s3.length();
-                
+
+             while ( isWhitespace( offset ) )
+                offset++;
+
+
             advance( offset );
 
             return true;
         }
+        private boolean tokenize ( String s1, String s2, String s3,String s4) {
+            assert s1.length() > 0;
+            assert s2.length() > 0;
+            assert s3.length() > 0;
+            assert s4.length() > 0;
+
+            int offset = 0;
+
+            while ( isWhitespace( offset ) )
+                offset++;
+
+            if (!startsWith( s1, offset ))
+                return false;
+
+            offset += s1.length();
+
+            while ( isWhitespace( offset ) )
+                offset++;
+
+            if (!startsWith( s2, offset ))
+                return false;
+
+            offset += s2.length();
+
+            while ( isWhitespace( offset ) )
+                offset++;
+
+            if (!startsWith( s3, offset ))
+                return false;
+
+            offset += s3.length();
+
+             while ( isWhitespace( offset ) )
+                offset++;
+
+            if (!startsWith( s4, offset ))
+                return false;
+
+            offset += s4.length();
+
+            advance( offset );
+
+            return true;
+        }
+
 
         private String tokenizeNCName ( ) throws XPathCompileException
         {
@@ -864,14 +914,26 @@
 
                     _namespaces.put( prefix, uri );
 
+                    //return these to saxon:? Is it an error to pass external NS
+                    //that conflicts? or should we just override it?
+                    if (_externalNamespaces.containsKey( prefix ))
+                    {
+                        throw newError(
+                            "Redefinition of namespace prefix: " + prefix );
+                    }
+                    _externalNamespaces.put( prefix, uri );
+
+                    if (! tokenize( ";" ))
+                       throw newError(
+                            "Namespace declaration must end with ;" ); 
+                    _externalNamespaces.put(_NS_BOUNDARY,new Integer(_offset));
+
                     continue;
                 }
                 
-                if (tokenize( "default", "element", "namespace" ))
+                if (tokenize( "declare","default", "element", "namespace" ))
                 {
-                    if (!tokenize( "=" ))
-                        throw newError( "Expected '='" );
-                    
+
                     String uri = tokenizeQuotedUri();
                     
                     if (_namespaces.containsKey( "" ))
@@ -882,6 +944,22 @@
 
                     _namespaces.put( "", uri );
 
+                    //return these to saxon:? Is it an error to pass external NS
+                     //that conflicts? or should we just override it?
+                      if (_externalNamespaces.containsKey( XPath._DEFAULT_ELT_NS ))
+                                     {
+                                         throw newError(
+                                             "Redefinition of default element namespace : ");
+                                     }
+                                     _externalNamespaces.put( XPath._DEFAULT_ELT_NS, uri );
+
+                                     if (! tokenize( ";" ))
+                                        throw newError(
+                                             "Default Namespace declaration must end with ;" );
+                                     //the boundary is the last ; in the prolog...
+                                     _externalNamespaces.put(_NS_BOUNDARY,new Integer(_offset));
+
+
                     continue;
                 }
                 
@@ -906,6 +984,12 @@
             return new XPath( selector, _sawDeepDot );
         }
 
+        //split of prolog decls that are not standard XPath syntax
+        //but work in v1
+        private void processNonXpathDecls(){
+
+        }
+
         private String _expr;
 
         private boolean _sawDeepDot;  // Saw one overall
@@ -913,7 +997,8 @@
 
         private String _currentNodeVar;
         
-        private Map _namespaces;
+       // private Map _namespaces;
+        protected Map _namespaces;
         private Map _externalNamespaces;
         
         private int _offset;
@@ -1001,6 +1086,8 @@
         return _sawDeepDot;
     }
 
+    public static final String _NS_BOUNDARY = "$xmlbeans!ns_boundary";
+     public static final String _DEFAULT_ELT_NS = "$xmlbeans!default_uri";
     private final Selector _selector;
     private final boolean  _sawDeepDot;
 }

Modified: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java&r1=125212&p2=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java	(original)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java	Fri Jan 14 13:48:30 2005
@@ -58,157 +58,137 @@
 import org.apache.xmlbeans.impl.newstore2.Locale.ChangeListener;
 import org.apache.xmlbeans.impl.newstore2.Path.PathEngine;
 
-public final class Cursor implements XmlCursor, ChangeListener
-{
-    static final int ROOT     = Cur.ROOT;
-    static final int ELEM     = Cur.ELEM;
-    static final int ATTR     = Cur.ATTR;
-    static final int COMMENT  = Cur.COMMENT;
+public final class Cursor implements XmlCursor, ChangeListener {
+    static final int ROOT = Cur.ROOT;
+    static final int ELEM = Cur.ELEM;
+    static final int ATTR = Cur.ATTR;
+    static final int COMMENT = Cur.COMMENT;
     static final int PROCINST = Cur.PROCINST;
-    static final int TEXT     = Cur.TEXT;
+    static final int TEXT = Cur.TEXT;
 
-    Cursor ( Xobj x, int p )
-    {
-        _cur = x._locale.weakCur( this );
-        _cur.moveTo( x, p );
+    Cursor(Xobj x, int p) {
+        _cur = x._locale.weakCur(this);
+        _cur.moveTo(x, p);
         _currentSelection = -1;
     }
-    
-    Cursor ( Cur c )
-    {
-        this( c._xobj, c._pos );
+
+    Cursor(Cur c) {
+        this(c._xobj, c._pos);
     }
 
-    private static boolean isValid ( Cur c )
-    {
-        if (c.kind() <= 0)
-        {
+    private static boolean isValid(Cur c) {
+        if (c.kind() <= 0) {
             c.push();
-            
-            if (c.toParentRaw())
-            {
+
+            if (c.toParentRaw()) {
                 int pk = c.kind();
 
                 if (pk == COMMENT || pk == PROCINST || pk == ATTR)
                     return false;
             }
-                
+
             c.pop();
         }
-        
+
         return true;
     }
-    
-    private boolean isValid ( )
-    {
-        return isValid( _cur );
+
+    private boolean isValid() {
+        return isValid(_cur);
     }
 
-    Locale locale ( )
-    {
+    Locale locale() {
         return _cur._locale;
     }
-    
-    Cur tempCur ( )
-    {
+
+    Cur tempCur() {
         return _cur.tempCur();
     }
 
-    public void dump ( PrintStream o )
-    {
-        _cur.dump( o );
+    public void dump(PrintStream o) {
+        _cur.dump(o);
     }
-    
-    static void validateLocalName ( QName name )
-    {
+
+    static void validateLocalName(QName name) {
         if (name == null)
-            throw new IllegalArgumentException( "QName is null" );
+            throw new IllegalArgumentException("QName is null");
 
-        validateLocalName( name.getLocalPart() );
+        validateLocalName(name.getLocalPart());
     }
 
-    static void validateLocalName ( String name )
-    {
+    static void validateLocalName(String name) {
         if (name == null)
-            throw new IllegalArgumentException( "Name is null" );
+            throw new IllegalArgumentException("Name is null");
 
         if (name.length() == 0)
-            throw new IllegalArgumentException( "Name is empty" );
+            throw new IllegalArgumentException("Name is empty");
 
-        if (!XMLChar.isValidNCName( name ))
-            throw new IllegalArgumentException( "Name is not valid" );
+        if (!XMLChar.isValidNCName(name))
+            throw new IllegalArgumentException("Name is not valid");
     }
 
-    static void validatePrefix ( String name )
-    {
+    static void validatePrefix(String name) {
         if (name == null)
-            throw new IllegalArgumentException( "Prefix is null" );
+            throw new IllegalArgumentException("Prefix is null");
 
         if (name.length() == 0)
-            throw new IllegalArgumentException( "Prefix is empty" );
+            throw new IllegalArgumentException("Prefix is empty");
 
-        if (Locale.beginsWithXml( name ))
-            throw new IllegalArgumentException( "Prefix begins with 'xml'" );
+        if (Locale.beginsWithXml(name))
+            throw new IllegalArgumentException("Prefix begins with 'xml'");
 
-        if (!XMLChar.isValidNCName( name ))
-            throw new IllegalArgumentException( "Prefix is not valid" );
+        if (!XMLChar.isValidNCName(name))
+            throw new IllegalArgumentException("Prefix is not valid");
     }
 
-    private static void complain ( String msg )
-    {
-        throw new IllegalArgumentException( msg );
+    private static void complain(String msg) {
+        throw new IllegalArgumentException(msg);
     }
 
-    private void checkInsertionValidity ( Cur that )
-    {
+    private void checkInsertionValidity(Cur that) {
         int thatKind = that.kind();
 
         if (thatKind < 0)
-            complain( "Can't move/copy/insert an end token." );
+            complain("Can't move/copy/insert an end token.");
 
         if (thatKind == ROOT)
-            complain( "Can't move/copy/insert a whole document." );
+            complain("Can't move/copy/insert a whole document.");
 
         int thisKind = _cur.kind();
 
         if (thisKind == ROOT)
-            complain( "Can't insert before the start of the document." );
+            complain("Can't insert before the start of the document.");
 
-        if (thatKind == ATTR)
-        {
+        if (thatKind == ATTR) {
             _cur.push();
             _cur.prevWithAttrs();
             int pk = _cur.kind();
             _cur.pop();
 
-            if (pk != ELEM && pk != ROOT && pk != -ATTR)
-            {
-                complain(
-                    "Can only insert attributes before other attributes or after containers." );
+            if (pk != ELEM && pk != ROOT && pk != -ATTR) {
+                complain("Can only insert attributes before other attributes or after containers.");
             }
         }
 
         if (thisKind == ATTR && thatKind != ATTR)
-            complain( "Can only insert attributes before other attributes or after containers." );
+            complain("Can only insert attributes before other attributes or after containers.");
     }
-    
-    private void insertNode ( Cur that, String text )
-    {
+
+    private void insertNode(Cur that, String text) {
         assert !that.isRoot();
         assert that.isNode();
-        assert isValid( that );
+        assert isValid(that);
         assert isValid();
 
-        if (text != null && text.length() > 0)
-        {
+        if (text != null && text.length() > 0) {
             that.next();
-            that.insertString( text );
+            that.insertString(text);
             that.toParent();
         }
 
-        checkInsertionValidity( that );
+        checkInsertionValidity(that);
 
-        that.moveNode( _cur );
+        that.moveNode(_cur);
 
         _cur.toEnd();
         _cur.nextWithAttrs();
@@ -223,157 +203,186 @@
     // change from a phantom ref to a soft/weak ref so I can know what
     // to do when I dequeue from the old q.
     
-    public void _dispose ( )
-    {
+    public void _dispose() {
         _cur.release();
         _cur = null;
     }
-    
-    public XmlCursor _newCursor ( )
-    {
-        return new Cursor( _cur );
+
+    public XmlCursor _newCursor() {
+        return new Cursor(_cur);
     }
 
-    public QName _getName ( )
-    {
+    public QName _getName() {
         // TODO - consider taking this out of the gateway
         
-        switch ( _cur.kind() )
-        {
-            case ATTR :
+        switch (_cur.kind()) {
+            case ATTR:
 
-                if (_cur.isXmlns())
-                {
+                if (_cur.isXmlns()) {
                     return
-                        _cur._locale.makeQNameNoCheck( _cur.getXmlnsUri(), _cur.getXmlnsPrefix() );
+                            _cur._locale.makeQNameNoCheck(_cur.getXmlnsUri(), _cur.getXmlnsPrefix());
                 }
 
                 // Fall thru
                 
-            case ELEM :
-            case PROCINST :
+            case ELEM:
+            case PROCINST:
                 return _cur.getName();
         }
 
         return null;
     }
-    
-    public void _setName ( QName name )
-    {
+
+    public void _setName(QName name) {
         if (name == null)
-            throw new IllegalArgumentException( "Name is null" );
+            throw new IllegalArgumentException("Name is null");
+
+        switch (_cur.kind()) {
+            case ELEM:
+            case ATTR:
+                {
+                    validateLocalName(name.getLocalPart());
+                    break;
+                }
 
-        switch ( _cur.kind() )
-        {
-        case ELEM :
-        case ATTR :
-        {
-            validateLocalName( name.getLocalPart() );
-            break;
-        }
-                    
-        case PROCINST :
-        {
-            validatePrefix( name.getLocalPart() );
+            case PROCINST:
+                {
+                    validatePrefix(name.getLocalPart());
 
-            if (name.getNamespaceURI().length() > 0)
-                throw new IllegalArgumentException( "Procinst name must have no URI" );
-            
-            if (name.getPrefix().length() > 0)
-                throw new IllegalArgumentException( "Procinst name must have no prefix" );
+                    if (name.getNamespaceURI().length() > 0)
+                        throw new IllegalArgumentException("Procinst name must have no URI");
 
-            break;
-        }
+                    if (name.getPrefix().length() > 0)
+                        throw new IllegalArgumentException("Procinst name must have no prefix");
 
-        default :
-            throw
-                new IllegalStateException(
-                    "Can set name on element, atrtribute and procinst only" );
+                    break;
+                }
+
+            default :
+                throw
+                        new IllegalStateException("Can set name on element, atrtribute and procinst only");
         }
 
-        _cur.setName( name );
+        _cur.setName(name);
     }
-    
-    public TokenType _currentTokenType ( )
-    {
+
+    public TokenType _currentTokenType() {
         assert isValid();
-        
-        switch ( _cur.kind() )
-        {
-        case   ROOT     : return TokenType.STARTDOC;
-        case - ROOT     : return TokenType.ENDDOC;
-        case   ELEM     : return TokenType.START;
-        case - ELEM     : return TokenType.END;
-        case   TEXT     : return TokenType.TEXT;
-        case   ATTR     : return _cur.isXmlns() ? TokenType.NAMESPACE : TokenType.ATTR;
-        case   COMMENT  : return TokenType.COMMENT;
-        case   PROCINST : return TokenType.PROCINST;
-
-        default :
-            throw new IllegalStateException();
+
+        switch (_cur.kind()) {
+            case ROOT:
+                return TokenType.STARTDOC;
+            case -ROOT:
+                return TokenType.ENDDOC;
+            case ELEM:
+                return TokenType.START;
+            case -ELEM:
+                return TokenType.END;
+            case TEXT:
+                return TokenType.TEXT;
+            case ATTR:
+                return _cur.isXmlns() ? TokenType.NAMESPACE : TokenType.ATTR;
+            case COMMENT:
+                return TokenType.COMMENT;
+            case PROCINST:
+                return TokenType.PROCINST;
+
+            default :
+                throw new IllegalStateException();
         }
     }
 
-    public boolean _isStartdoc   ( ){ return _currentTokenType().isStartdoc();  }
-    public boolean _isEnddoc     ( ){ return _currentTokenType().isEnddoc();    }
-    public boolean _isStart      ( ){ return _currentTokenType().isStart();     }
-    public boolean _isEnd        ( ){ return _currentTokenType().isEnd();       }
-    public boolean _isText       ( ){ return _currentTokenType().isText();      }
-    public boolean _isAttr       ( ){ return _currentTokenType().isAttr();      }
-    public boolean _isNamespace  ( ){ return _currentTokenType().isNamespace(); }
-    public boolean _isComment    ( ){ return _currentTokenType().isComment();   }
-    public boolean _isProcinst   ( ){ return _currentTokenType().isProcinst();  }
-    public boolean _isContainer  ( ){ return _currentTokenType().isContainer(); }
-    public boolean _isFinish     ( ){ return _currentTokenType().isFinish();    }
-    public boolean _isAnyAttr    ( ){ return _currentTokenType().isAnyAttr();   }
+    public boolean _isStartdoc() {
+        return _currentTokenType().isStartdoc();
+    }
+
+    public boolean _isEnddoc() {
+        return _currentTokenType().isEnddoc();
+    }
+
+    public boolean _isStart() {
+        return _currentTokenType().isStart();
+    }
+
+    public boolean _isEnd() {
+        return _currentTokenType().isEnd();
+    }
+
+    public boolean _isText() {
+        return _currentTokenType().isText();
+    }
+
+    public boolean _isAttr() {
+        return _currentTokenType().isAttr();
+    }
+
+    public boolean _isNamespace() {
+        return _currentTokenType().isNamespace();
+    }
+
+    public boolean _isComment() {
+        return _currentTokenType().isComment();
+    }
+
+    public boolean _isProcinst() {
+        return _currentTokenType().isProcinst();
+    }
+
+    public boolean _isContainer() {
+        return _currentTokenType().isContainer();
+    }
+
+    public boolean _isFinish() {
+        return _currentTokenType().isFinish();
+    }
+
+    public boolean _isAnyAttr() {
+        return _currentTokenType().isAnyAttr();
+    }
 
-    public TokenType _toNextToken ( )
-    {
+    public TokenType _toNextToken() {
         assert isValid();
-        
-        switch ( _cur.kind() )
-        {
-        case ROOT :
-        case ELEM :
-        {
-            if (!_cur.toFirstAttr())
-                _cur.next();
 
-            break;
-        }
-        
-        case ATTR :
-        {
-            if (!_cur.toNextSibling())
-            {
-                _cur.toParent();
-                _cur.next();
-            }
+        switch (_cur.kind()) {
+            case ROOT:
+            case ELEM:
+                {
+                    if (!_cur.toFirstAttr())
+                        _cur.next();
 
-            break;
-        }
+                    break;
+                }
 
-        case COMMENT :
-        case PROCINST :
-        {
-            _cur.skip();
-            break;
-        }
-        
-        default :
-        {
-            if (!_cur.next())
-                return TokenType.NONE;
-                        
-            break;
-        }
+            case ATTR:
+                {
+                    if (!_cur.toNextSibling()) {
+                        _cur.toParent();
+                        _cur.next();
+                    }
+
+                    break;
+                }
+
+            case COMMENT:
+            case PROCINST:
+                {
+                    _cur.skip();
+                    break;
+                }
+
+            default :
+                {
+                    if (!_cur.next())
+                        return TokenType.NONE;
+
+                    break;
+                }
         }
 
         return _currentTokenType();
     }
 
-    public TokenType _toPrevToken ( )
-    {
+    public TokenType _toPrevToken() {
         assert isValid();
 
         // This method is different than the Cur version of prev in a few ways.  First,
@@ -384,17 +393,14 @@
         
         boolean wasText = _cur.isText();
 
-        if (!_cur.prev())
-        {
+        if (!_cur.prev()) {
             assert _cur.isRoot() || _cur.isAttr();
-            
+
             if (_cur.isRoot())
                 return TokenType.NONE;
-            
+
             _cur.toParent();
-        }
-        else
-        {
+        } else {
             int k = _cur.kind();
 
             if (k < 0 && (k == -COMMENT || k == -PROCINST || k == -ATTR))
@@ -404,192 +410,190 @@
             else if (wasText && _cur.isText())
                 return _toPrevToken();
         }
-        
+
         return _currentTokenType();
     }
-    
-    public Object _monitor ( )
-    {
+
+    public Object _monitor() {
         // TODO - some of these methods need not be protected by a
         // gatway.  This is one of them.  Inline this.
 
         return _cur._locale;
     }
-    
-    public boolean _toParent ( )
-    {
+
+    public boolean _toParent() {
         Cur c = _cur.tempCur();
 
         if (!c.toParent())
             return false;
 
-        _cur.moveToCur( c );
+        _cur.moveToCur(c);
 
         c.release();
 
         return true;
     }
 
-    private static final class ChangeStampImpl implements ChangeStamp
-    {
-        ChangeStampImpl ( Locale l )
-        {
+    private static final class ChangeStampImpl implements ChangeStamp {
+        ChangeStampImpl(Locale l) {
             _locale = l;
             _versionStamp = _locale.version();
         }
 
-        public boolean hasChanged ( )
-        {
+        public boolean hasChanged() {
             return _versionStamp != _locale.version();
         }
 
         private final Locale _locale;
-        private final long   _versionStamp;
+        private final long _versionStamp;
     }
 
-    public ChangeStamp _getDocChangeStamp ( )
-    {
-        return new ChangeStampImpl( _cur._locale );
+    public ChangeStamp _getDocChangeStamp() {
+        return new ChangeStampImpl(_cur._locale);
     }
 
     //
     // These simply delegate to the version of the method which takes XmlOptions
     //
     
-    public XMLInputStream  _newXMLInputStream ( )  { return _newXMLInputStream( null ); }
-    public XMLStreamReader _newXMLStreamReader ( ) { return _newXMLStreamReader( null ); }
-    public Node            _newDomNode ( )         { return _newDomNode( null ); }
-    public InputStream     _newInputStream ( )     { return _newInputStream( null ); }
-    public String          _xmlText ( )            { return _xmlText( null ); }
-    public Reader          _newReader ( )          { return _newReader( null ); }
-    
-    public void _save ( File file )       throws IOException { _save( file, null ); }
-    public void _save ( OutputStream os ) throws IOException { _save( os, null ); }
-    public void _save ( Writer w )        throws IOException { _save( w, null ); }
-    
-    public void _save ( ContentHandler ch, LexicalHandler lh ) throws SAXException { _save( ch, lh, null ); }
+    public XMLInputStream _newXMLInputStream() {
+        return _newXMLInputStream(null);
+    }
+
+    public XMLStreamReader _newXMLStreamReader() {
+        return _newXMLStreamReader(null);
+    }
+
+    public Node _newDomNode() {
+        return _newDomNode(null);
+    }
+
+    public InputStream _newInputStream() {
+        return _newInputStream(null);
+    }
+
+    public String _xmlText() {
+        return _xmlText(null);
+    }
+
+    public Reader _newReader() {
+        return _newReader(null);
+    }
+
+    public void _save(File file) throws IOException {
+        _save(file, null);
+    }
+
+    public void _save(OutputStream os) throws IOException {
+        _save(os, null);
+    }
+
+    public void _save(Writer w) throws IOException {
+        _save(w, null);
+    }
+
+    public void _save(ContentHandler ch, LexicalHandler lh) throws SAXException {
+        _save(ch, lh, null);
+    }
 
     //
     //
     //
 
-    public XmlDocumentProperties _documentProperties ( )
-    {
-        return Locale.getDocProps( _cur, true );
+    public XmlDocumentProperties _documentProperties() {
+        return Locale.getDocProps(_cur, true);
     }
 
-    public XMLStreamReader _newXMLStreamReader ( XmlOptions options )
-    {
-        return Jsr173.newXmlStreamReader( _cur, options );
+    public XMLStreamReader _newXMLStreamReader(XmlOptions options) {
+        return Jsr173.newXmlStreamReader(_cur, options);
     }
 
-    public XMLInputStream _newXMLInputStream ( XmlOptions options )
-    {
-        throw new RuntimeException( "Not implemented" );
+    public XMLInputStream _newXMLInputStream(XmlOptions options) {
+        throw new RuntimeException("Not implemented");
     }
 
-    public String _xmlText ( XmlOptions options )
-    {
+    public String _xmlText(XmlOptions options) {
         assert isValid();
-        
-        return new TextSaver( _cur, options, null ).saveToString();
+
+        return new TextSaver(_cur, options, null).saveToString();
     }
-    
-    public InputStream _newInputStream ( XmlOptions options )
-    {
-        return new Saver.InputStreamSaver( _cur, options );
+
+    public InputStream _newInputStream(XmlOptions options) {
+        return new Saver.InputStreamSaver(_cur, options);
     }
 
-    public Reader _newReader( XmlOptions options )
-    {
-        return new Saver.TextReader( _cur, options );
+    public Reader _newReader(XmlOptions options) {
+        return new Saver.TextReader(_cur, options);
     }
-    
-    public void _save ( ContentHandler ch, LexicalHandler lh, XmlOptions options )
-        throws SAXException
-    {
-        new Saver.SaxSaver( _cur, options, ch, lh );
+
+    public void _save(ContentHandler ch, LexicalHandler lh, XmlOptions options)
+            throws SAXException {
+        new Saver.SaxSaver(_cur, options, ch, lh);
     }
-    
-    public void _save ( File file, XmlOptions options ) throws IOException
-    {
+
+    public void _save(File file, XmlOptions options) throws IOException {
         if (file == null)
-            throw new IllegalArgumentException( "Null file specified" );
-        
-        OutputStream os = new FileOutputStream( file );
+            throw new IllegalArgumentException("Null file specified");
 
-        try
-        {
-            _save( os, options );
-        }
-        finally
-        {
+        OutputStream os = new FileOutputStream(file);
+
+        try {
+            _save(os, options);
+        } finally {
             os.close();
         }
     }
-    
-    public void _save ( OutputStream os, XmlOptions options ) throws IOException
-    {
+
+    public void _save(OutputStream os, XmlOptions options) throws IOException {
         if (os == null)
-            throw new IllegalArgumentException( "Null OutputStream specified" );
-        
-        InputStream is = _newInputStream( options );
+            throw new IllegalArgumentException("Null OutputStream specified");
+
+        InputStream is = _newInputStream(options);
 
-        try
-        {
-            byte[] bytes = new byte[ 8192 ];
-
-            for ( ; ; )
-            {
-                int n = is.read( bytes );
+        try {
+            byte[] bytes = new byte[8192];
+
+            for (; ;) {
+                int n = is.read(bytes);
 
                 if (n < 0)
                     break;
 
-                os.write( bytes, 0, n );
+                os.write(bytes, 0, n);
             }
-        }
-        finally
-        {
+        } finally {
             is.close();
         }
     }
-    
-    public void _save ( Writer w, XmlOptions options ) throws IOException
-    {
+
+    public void _save(Writer w, XmlOptions options) throws IOException {
         if (w == null)
-            throw new IllegalArgumentException( "Null Writer specified" );
-        
-        Reader r = _newReader( options );
+            throw new IllegalArgumentException("Null Writer specified");
+
+        Reader r = _newReader(options);
 
-        try
-        {
-            char[] chars = new char[ 8192 ];
-
-            for ( ; ; )
-            {
-                int n = r.read( chars );
+        try {
+            char[] chars = new char[8192];
+
+            for (; ;) {
+                int n = r.read(chars);
 
                 if (n < 0)
                     break;
 
-                w.write( chars, 0, n );
+                w.write(chars, 0, n);
             }
-        }
-        finally
-        {
+        } finally {
             r.close();
         }
     }
-    
-    public Node _getDomNode ( )
-    {
+
+    public Node _getDomNode() {
         return (Node) _cur.getDom();
     }
-    
-    private boolean isDomFragment ( )
-    {
-        if (! isStartdoc())
+
+    private boolean isDomFragment() {
+        if (!isStartdoc())
             return true;
 
         boolean seenElement = false;
@@ -597,12 +601,9 @@
         XmlCursor c = newCursor();
         int token = c.toNextToken().intValue();
 
-        try
-        {
-            LOOP: for ( ; ; )
-            {
-                SWITCH: switch ( token )
-                {
+        try {
+            LOOP: for (; ;) {
+                SWITCH: switch (token) {
                     case TokenType.INT_START:
                         if (seenElement)
                             return true;
@@ -611,7 +612,7 @@
                         break SWITCH;
 
                     case TokenType.INT_TEXT:
-                        if (!Locale.isWhiteSpace( c.getChars() ))
+                        if (!Locale.isWhiteSpace(c.getChars()))
                             return true;
                         token = c.toNextToken().intValue();
                         break SWITCH;
@@ -635,21 +636,17 @@
                         break LOOP;
                 }
             }
-        }
-        finally
-        {
+        } finally {
             c.dispose();
         }
 
         return !seenElement;
     }
 
-    private static final class DomSaver extends Saver
-    {
-        DomSaver ( Cur c, boolean isFrag, XmlOptions options )
-        {
-            super( c, options );
-            
+    private static final class DomSaver extends Saver {
+        DomSaver(Cur c, boolean isFrag, XmlOptions options) {
+            super(c, options);
+
             if (c.isUserNode())
                 _type = c.getUser().get_schema_type();
 
@@ -658,28 +655,26 @@
             _isFrag = isFrag;
         }
 
-        Node saveDom ( )
-        {
-            Locale l = Locale.getLocale( _stl, _options );
+        Node saveDom() {
+            Locale l = Locale.getLocale(_stl, _options);
 
             l.enter();
 
-            try
-            {
+            try {
                 _nodeCur = l.getCur();  // Not weak or temp
 
                 // Build the tree
                 
-                while ( process() )
+                while (process())
                     ;
 
                 // Set the type
 
-                while ( !_nodeCur.isRoot() )
+                while (!_nodeCur.isRoot())
                     _nodeCur.toParent();
 
                 if (_type != null)
-                    _nodeCur.setType( _type );
+                    _nodeCur.setType(_type);
 
                 Node node = (Node) _nodeCur.getDom();
 
@@ -688,129 +683,112 @@
                 _nodeCur = null;
 
                 return node;
-            }
-            finally
-            {
+            } finally {
                 l.exit();
             }
         }
-        
-        protected boolean emitElement ( SaveCur c, ArrayList attrNames, ArrayList attrValues )
-        {
+
+        protected boolean emitElement(SaveCur c, ArrayList attrNames, ArrayList attrValues) {
             // If there was text or comments before the frag element, I will loose them -- oh well
             // Also, I will lose any attributes and namesapces on the fragment -- DOM can
             // have attrs in fragments
             
-            if (Locale.isFragmentQName( c.getName() ))
-                _nodeCur.moveTo( null, Cur.NO_POS );
-            
+            if (Locale.isFragmentQName(c.getName()))
+                _nodeCur.moveTo(null, Cur.NO_POS);
+
             ensureDoc();
 
-            _nodeCur.createElement( getQualifiedName( c, c.getName() ) );
+            _nodeCur.createElement(getQualifiedName(c, c.getName()));
             _nodeCur.next();
 
-            for ( iterateMappings() ; hasMapping() ; nextMapping() )
-            {
-                _nodeCur.createAttr( _nodeCur._locale.createXmlns( mappingPrefix() ) );
+            for (iterateMappings(); hasMapping(); nextMapping()) {
+                _nodeCur.createAttr(_nodeCur._locale.createXmlns(mappingPrefix()));
                 _nodeCur.next();
-                _nodeCur.insertString( mappingUri() );
+                _nodeCur.insertString(mappingUri());
                 _nodeCur.toParent();
                 _nodeCur.skipWithAttrs();
             }
 
-            for ( int i = 0 ; i < attrNames.size() ; i ++ )
-            {
-                _nodeCur.createAttr( getQualifiedName( c, (QName) attrNames.get( i ) ) );
+            for (int i = 0; i < attrNames.size(); i++) {
+                _nodeCur.createAttr(getQualifiedName(c, (QName) attrNames.get(i)));
                 _nodeCur.next();
-                _nodeCur.insertString( (String) attrValues.get( i ) );
+                _nodeCur.insertString((String) attrValues.get(i));
                 _nodeCur.toParent();
                 _nodeCur.skipWithAttrs();
             }
-            
+
             return false;
         }
-        
-        protected void emitFinish ( SaveCur c )
-        {
-            if (!Locale.isFragmentQName( c.getName() ))
-            {
+
+        protected void emitFinish(SaveCur c) {
+            if (!Locale.isFragmentQName(c.getName())) {
                 assert _nodeCur.isEnd();
                 _nodeCur.next();
             }
         }
-        
-        protected void emitText ( SaveCur c )
-        {
+
+        protected void emitText(SaveCur c) {
             ensureDoc();
 
             Object src = c.getChars();
 
-            if (c._cchSrc > 0)
-            {
-                _nodeCur.insertChars( src, c._offSrc, c._cchSrc );
+            if (c._cchSrc > 0) {
+                _nodeCur.insertChars(src, c._offSrc, c._cchSrc);
                 _nodeCur.next();
             }
         }
-        
-        protected void emitComment ( SaveCur c )
-        {
+
+        protected void emitComment(SaveCur c) {
             ensureDoc();
 
             _nodeCur.createComment();
-            emitTextValue( c );
+            emitTextValue(c);
             _nodeCur.skip();
         }
-        
-        protected void emitProcinst ( SaveCur c )
-        {
+
+        protected void emitProcinst(SaveCur c) {
             ensureDoc();
 
-            _nodeCur.createProcinst( c.getName().getLocalPart() );
-            emitTextValue( c );
+            _nodeCur.createProcinst(c.getName().getLocalPart());
+            emitTextValue(c);
             _nodeCur.skip();
         }
-        
-        protected void emitDocType ( String docTypeName, String publicId, String systemId )
-        {
+
+        protected void emitDocType(String docTypeName, String publicId, String systemId) {
             ensureDoc();
 
-            XmlDocumentProperties props = Locale.getDocProps( _nodeCur, true );
+            XmlDocumentProperties props = Locale.getDocProps(_nodeCur, true);
             props.setDoctypeName(docTypeName);
             props.setDoctypePublicId(publicId);
             props.setDoctypeSystemId(systemId);
         }
 
-        private QName getQualifiedName ( SaveCur c, QName name )
-        {
+        private QName getQualifiedName(SaveCur c, QName name) {
             String uri = name.getNamespaceURI();
-            
-            String prefix = uri.length() > 0 ? getUriMapping( uri ) : "";
 
-            if (prefix.equals( name.getPrefix() ))
+            String prefix = uri.length() > 0 ? getUriMapping(uri) : "";
+
+            if (prefix.equals(name.getPrefix()))
                 return name;
 
-            return _nodeCur._locale.makeQName( uri, name.getLocalPart(), prefix );
+            return _nodeCur._locale.makeQName(uri, name.getLocalPart(), prefix);
         }
 
-        private void emitTextValue ( SaveCur c )
-        {
+        private void emitTextValue(SaveCur c) {
             c.push();
             c.next();
 
-            if (c.isText())
-            {
+            if (c.isText()) {
                 _nodeCur.next();
-                _nodeCur.insertChars( c.getChars(), c._offSrc, c._cchSrc );
+                _nodeCur.insertChars(c.getChars(), c._offSrc, c._cchSrc);
                 _nodeCur.toParent();
             }
 
             c.pop();
         }
-        
-        private void ensureDoc ( )
-        {
-            if (!_nodeCur.isPositioned())
-            {
+
+        private void ensureDoc() {
+            if (!_nodeCur.isPositioned()) {
                 if (_isFrag)
                     _nodeCur.createDomDocFragRoot();
                 else
@@ -820,47 +798,41 @@
             }
         }
 
-        private Cur              _nodeCur;
-        private SchemaType       _type;
+        private Cur _nodeCur;
+        private SchemaType _type;
         private SchemaTypeLoader _stl;
-        private XmlOptions       _options;
-        private boolean          _isFrag;
+        private XmlOptions _options;
+        private boolean _isFrag;
     }
-    
-    public Node _newDomNode ( XmlOptions options )
-    {
+
+    public Node _newDomNode(XmlOptions options) {
         // Must ignore inner options for compat with v1.
         
-        if (XmlOptions.hasOption( options, XmlOptions.SAVE_INNER ))
-        {
-            options = new XmlOptions( options );
-            options.remove( XmlOptions.SAVE_INNER );
+        if (XmlOptions.hasOption(options, XmlOptions.SAVE_INNER)) {
+            options = new XmlOptions(options);
+            options.remove(XmlOptions.SAVE_INNER);
         }
 
-        return new DomSaver( _cur, isDomFragment(), options ).saveDom();
+        return new DomSaver(_cur, isDomFragment(), options).saveDom();
     }
-    
-    public boolean _toCursor ( Cursor other )
-    {
+
+    public boolean _toCursor(Cursor other) {
         assert _cur._locale == other._cur._locale;
 
-        _cur.moveToCur( other._cur );
+        _cur.moveToCur(other._cur);
 
         return true;
     }
-    
-    public void _push ( )
-    {
+
+    public void _push() {
         _cur.push();
     }
-    
-    public boolean _pop ( )
-    {
+
+    public boolean _pop() {
         return _cur.pop();
     }
-    
-    public void notifyChange ( )
-    {
+
+    public void notifyChange() {
         // Force any path to get exausted, cursor may be disposed, but still be on the notification
         // list.
 
@@ -868,247 +840,239 @@
             _getSelectionCount();
     }
 
-    public void setNextChangeListener ( ChangeListener listener )
-    {
+    public void setNextChangeListener(ChangeListener listener) {
         _nextChangeListener = listener;
     }
-        
-    public ChangeListener getNextChangeListener ( )
-    {
+
+    public ChangeListener getNextChangeListener() {
         return _nextChangeListener;
     }
-    
-    public void _selectPath ( String path )
-    {
-        _selectPath( path, null );
+
+    public void _selectPath(String path) {
+        _selectPath(path, null);
     }
-    
-    public void _selectPath ( String pathExpr, XmlOptions options )
-    {
+
+    public void _selectPath(String pathExpr, XmlOptions options) {
         _clearSelections();
 
         assert _pathEngine == null;
-        
-        _pathEngine = Path.getCompiledPath( pathExpr, options ).execute( _cur );
 
-        _cur._locale.registerForChange( this );
+        _pathEngine = Path.getCompiledPath(pathExpr, options).execute(_cur);
+
+        _cur._locale.registerForChange(this);
     }
-    
-    public boolean _hasNextSelection ( )
-    {
+
+    public boolean _hasNextSelection() {
         int curr = _currentSelection;
         push();
 
-        try
-        {
+        try {
             return toNextSelection();
-        }
-        finally
-        {
+        } finally {
             _currentSelection = curr;
             pop();
         }
     }
-    
-    public boolean _toNextSelection ( )
-    {
-        return _toSelection( _currentSelection + 1 );
+
+    public boolean _toNextSelection() {
+        return _toSelection(_currentSelection + 1);
     }
-    
-    public boolean _toSelection ( int i )
-    {
+
+    public boolean _toSelection(int i) {
         if (i < 0)
             return false;
-        
-        while ( i >= _cur.selectionCount() )
-        {
+
+        while (i >= _cur.selectionCount()) {
             if (_pathEngine == null)
                 return false;
-            
-            if (!_pathEngine.next( _cur ))
-            {
+
+            if (!_pathEngine.next(_cur)) {
                 _pathEngine.release();
                 _pathEngine = null;
-                
+
                 return false;
             }
         }
 
-        _cur.moveToSelection( _currentSelection = i );
-        
+        _cur.moveToSelection(_currentSelection = i);
+
         return true;
     }
-    
-    public int _getSelectionCount ( )
-    {
+
+    public int _getSelectionCount() {
         // Should never get to MAX_VALUE selection index, so, state should not change
-        _toSelection( Integer.MAX_VALUE );
-        
+        _toSelection(Integer.MAX_VALUE);
+
         return _cur.selectionCount();
     }
-    
-    public void _addToSelection ( )
-    {
-        _toSelection( Integer.MAX_VALUE );
+
+    public void _addToSelection() {
+        _toSelection(Integer.MAX_VALUE);
 
         _cur.addToSelection();
     }
-    
-    public void _clearSelections ( )
-    {
-        if (_pathEngine != null)
-        {
+
+    public void _clearSelections() {
+        if (_pathEngine != null) {
             _pathEngine.release();
             _pathEngine = null;
         }
-        
+
         _cur.clearSelection();
-        
+
         _currentSelection = -1;
     }
-    
-    public String _namespaceForPrefix ( String prefix )
-    {
+
+    public String _namespaceForPrefix(String prefix) {
         if (!_cur.isContainer())
-            throw new IllegalStateException( "Not on a container" );
+            throw new IllegalStateException("Not on a container");
 
-        return _cur.namespaceForPrefix( prefix, true );
+        return _cur.namespaceForPrefix(prefix, true);
     }
-    
-    public String _prefixForNamespace ( String ns )
-    {
+
+    public String _prefixForNamespace(String ns) {
         if (ns == null || ns.length() == 0)
-            throw new IllegalArgumentException( "Must specify a namespace" );
+            throw new IllegalArgumentException("Must specify a namespace");
 
 // Note: I loosen this requirement in v2, can call this from anywhere
 //        if (!_cur.isContainer())
 //            throw new IllegalStateException( "Not on a container" );
 
-        return _cur.prefixForNamespace( ns, null, true );
+        return _cur.prefixForNamespace(ns, null, true);
     }
-    
-    public void _getAllNamespaces ( Map addToThis )
-    {
+
+    public void _getAllNamespaces(Map addToThis) {
         if (!_cur.isContainer())
-            throw new IllegalStateException( "Not on a container" );
+            throw new IllegalStateException("Not on a container");
 
         if (addToThis != null)
-            Locale.getAllNamespaces( _cur, addToThis );
+            Locale.getAllNamespaces(_cur, addToThis);
     }
-    
-    public XmlObject _getObject ( )
-    {
+
+    public XmlObject _getObject() {
         return _cur.getObject();
     }
-    
-    public TokenType _prevTokenType ( )
-    {
+
+    public TokenType _prevTokenType() {
         _cur.push();
-        
+
         TokenType tt = _toPrevToken();
-        
+
         _cur.pop();
 
         return tt;
     }
-    
-    public boolean _hasNextToken ( )
-    {
+
+    public boolean _hasNextToken() {
         return _cur.kind() != -ROOT;
     }
-    
-    public boolean _hasPrevToken ( )
-    {
+
+    public boolean _hasPrevToken() {
         return _cur.kind() != ROOT;
     }
-    
-    public TokenType _toFirstContentToken ( )
-    {
+
+    public TokenType _toFirstContentToken() {
         if (!_cur.isContainer())
             return TokenType.NONE;
 
         _cur.next();
-        
+
         return currentTokenType();
     }
-    
-    public TokenType _toEndToken ( )
-    {
+
+    public TokenType _toEndToken() {
         if (!_cur.isContainer())
             return TokenType.NONE;
 
         _cur.toEnd();
-        
+
         return currentTokenType();
     }
-    
-    public boolean _toChild ( String local ) { return _toChild( null, local ); }
-    public boolean _toChild ( QName name   ) { return _toChild( name, 0 ); }
-    public boolean _toChild ( int index    ) { return _toChild( null, index ); }
-    
-    public boolean _toChild ( String uri, String local )
-    {
-        validateLocalName( local );
 
-        return _toChild( _cur._locale.makeQName( uri, local ), 0 );
+    public boolean _toChild(String local) {
+        return _toChild(null, local);
     }
-    
-    public boolean _toChild ( QName name, int index )
-    {
-        return Locale.toChild( _cur, name, index );
+
+    public boolean _toChild(QName name) {
+        return _toChild(name, 0);
     }
-    
-    public int _toNextChar ( int maxCharacterCount ) { return _cur.nextChars( maxCharacterCount ); }
-    public int _toPrevChar ( int maxCharacterCount ) { return _cur.prevChars( maxCharacterCount ); }
-    public boolean _toNextSibling ( ) { return Locale.toNextSiblingElement( _cur ); }
-    public boolean _toPrevSibling ( ) { return Locale.toPrevSiblingElement( _cur ); }
-    public boolean _toLastChild ( ) { return Locale.toLastChildElement( _cur ); }
-    public boolean _toFirstChild ( ) { return Locale.toFirstChildElement( _cur ); }
-    public boolean _toNextSibling ( String name ) { return Locale.toNextSiblingElement( _cur ); }
-    
-    public boolean _toNextSibling ( String uri, String local )
-    {
-        validateLocalName( local );
-        
-        return _toNextSibling( _cur._locale._qnameFactory.getQName( uri, local ) );
+
+    public boolean _toChild(int index) {
+        return _toChild(null, index);
     }
-    
-    public boolean _toNextSibling ( QName name )
-    {
-        _cur.push();
 
-        while ( _toNextSibling() )
-        {
-            if (_cur.getName().equals( name ))
-            {
-                _cur.popButStay();
-                return true;
-            }
-        }
+    public boolean _toChild(String uri, String local) {
+        validateLocalName(local);
+
+        return _toChild(_cur._locale.makeQName(uri, local), 0);
+    }
+
+    public boolean _toChild(QName name, int index) {
+        return Locale.toChild(_cur, name, index);
+    }
+
+    public int _toNextChar(int maxCharacterCount) {
+        return _cur.nextChars(maxCharacterCount);
+    }
+
+    public int _toPrevChar(int maxCharacterCount) {
+        return _cur.prevChars(maxCharacterCount);
+    }
+
+    public boolean _toNextSibling() {
+        return Locale.toNextSiblingElement(_cur);
+    }
+
+    public boolean _toPrevSibling() {
+        return Locale.toPrevSiblingElement(_cur);
+    }
+
+    public boolean _toLastChild() {
+        return Locale.toLastChildElement(_cur);
+    }
+
+    public boolean _toFirstChild() {
+        return Locale.toFirstChildElement(_cur);
+    }
+
+    public boolean _toNextSibling(String name) {
+        return Locale.toNextSiblingElement(_cur);
+    }
+
+    public boolean _toNextSibling(String uri, String local) {
+        validateLocalName(local);
+
+        return _toNextSibling(_cur._locale._qnameFactory.getQName(uri, local));
+    }
+
+    public boolean _toNextSibling(QName name) {
+        _cur.push();
+
+        while (_toNextSibling()) {
+            if (_cur.getName().equals(name)) {
+                _cur.popButStay();
+                return true;
+            }
+        }
 
         _cur.pop();
 
         return false;
     }
-    
-    public boolean _toFirstAttribute ( )
-    {
-        return _cur.isContainer() && Locale.toFirstNormalAttr( _cur );
+
+    public boolean _toFirstAttribute() {
+        return _cur.isContainer() && Locale.toFirstNormalAttr(_cur);
     }
-    
-    public boolean _toLastAttribute ( )
-    {
-        if (_cur.isContainer())
-        {
+
+    public boolean _toLastAttribute() {
+        if (_cur.isContainer()) {
             _cur.push();
             _cur.push();
 
             boolean foundAttr = false;
 
-            while ( _cur.toNextAttr() )
-            {
-                if (_cur.isNormalAttr())
-                {
+            while (_cur.toNextAttr()) {
+                if (_cur.isNormalAttr()) {
                     _cur.popButStay();
                     _cur.push();
                     foundAttr = true;
@@ -1116,9 +1080,8 @@
             }
 
             _cur.pop();
-            
-            if (foundAttr)
-            {
+
+            if (foundAttr) {
                 _cur.popButStay();
                 return true;
             }
@@ -1128,98 +1091,87 @@
 
         return false;
     }
-    
-    public boolean _toNextAttribute ( )
-    {
-        return _cur.isAttr() && Locale.toNextNormalAttr( _cur );
+
+    public boolean _toNextAttribute() {
+        return _cur.isAttr() && Locale.toNextNormalAttr(_cur);
     }
-    
-    public boolean _toPrevAttribute ( )
-    {
-        return _cur.isAttr() && Locale.toPrevNormalAttr( _cur );
+
+    public boolean _toPrevAttribute() {
+        return _cur.isAttr() && Locale.toPrevNormalAttr(_cur);
     }
-    
-    public String _getAttributeText ( QName attrName )
-    {
+
+    public String _getAttributeText(QName attrName) {
         if (attrName == null)
-            throw new IllegalArgumentException( "Attr name is null" );
+            throw new IllegalArgumentException("Attr name is null");
 
         if (!_cur.isContainer())
             return null;
 
-        return _cur.getAttrValue( attrName );
+        return _cur.getAttrValue(attrName);
     }
-    
-    public boolean _setAttributeText ( QName attrName, String value )
-    {
+
+    public boolean _setAttributeText(QName attrName, String value) {
         if (attrName == null)
-            throw new IllegalArgumentException( "Attr name is null" );
+            throw new IllegalArgumentException("Attr name is null");
 
-        validateLocalName( attrName.getLocalPart() );
+        validateLocalName(attrName.getLocalPart());
 
         if (!_cur.isContainer())
             return false;
 
-        _cur.setAttrValue( attrName, value );
+        _cur.setAttrValue(attrName, value);
 
         return true;
     }
-    
-    public boolean _removeAttribute ( QName attrName )
-    {
+
+    public boolean _removeAttribute(QName attrName) {
         if (attrName == null)
-            throw new IllegalArgumentException( "Attr name is null" );
+            throw new IllegalArgumentException("Attr name is null");
 
         if (!_cur.isContainer())
             return false;
 
-        return _cur.removeAttr( attrName );
+        return _cur.removeAttr(attrName);
     }
-    
-    public String _getTextValue ( )
-    {
+
+    public String _getTextValue() {
         if (_cur.isText())
             return _getChars();
-        
-        if (!_cur.isNode())
-        {
-            throw new IllegalStateException(
-                "Can't get text value, current token can have no text value" );
+
+        if (!_cur.isNode()) {
+            throw new IllegalStateException("Can't get text value, current token can have no text value");
         }
 
-        return _cur.hasChildren() ? Locale.getTextValue( _cur ) : _cur.getValueAsString();
+        return _cur.hasChildren() ? Locale.getTextValue(_cur) : _cur.getValueAsString();
     }
-    
-    public int _getTextValue ( char[] chars, int offset, int max )
-    {
+
+    public int _getTextValue(char[] chars, int offset, int max) {
         if (_cur.isText())
-            return _getChars( chars, offset, max );
+            return _getChars(chars, offset, max);
 
         if (chars == null)
-            throw new IllegalArgumentException( "char buffer is null" );
+            throw new IllegalArgumentException("char buffer is null");
 
         if (offset < 0)
-            throw new IllegalArgumentException( "offset < 0" );
+            throw new IllegalArgumentException("offset < 0");
 
         if (offset >= chars.length)
-            throw new IllegalArgumentException( "offset off end" );
+            throw new IllegalArgumentException("offset off end");
 
         if (max < 0)
             max = Integer.MAX_VALUE;
 
         if (offset + max > chars.length)
             max = chars.length - offset;
-        
-        if (!_cur.isNode())
-        {
-            throw new IllegalStateException(
-                "Can't get text value, current token can have no text value" );
+
+        if (!_cur.isNode()) {
+            throw new IllegalStateException("Can't get text value, current token can have no text value");
         }
 
         // If there are no children (hopefully the common case), I can get the text faster.
 
         if (_cur.hasChildren())
-            return Locale.getTextValue( _cur, Locale.WS_PRESERVE, chars, offset, max );
+            return Locale.getTextValue(_cur, Locale.WS_PRESERVE, chars, offset, max);
 
         // Fast way
             
@@ -1231,191 +1183,169 @@
         if (_cur._cchSrc <= 0)
             return 0;
 
-        CharUtil.getChars( chars, offset, src, _cur._offSrc, _cur._cchSrc );
+        CharUtil.getChars(chars, offset, src, _cur._offSrc, _cur._cchSrc);
 
         return _cur._cchSrc;
     }
-    
-    private void setTextValue ( Object src, int off, int cch )
-    {
-        if (!_cur.isNode())
-        {
-            throw new IllegalStateException(
-                "Can't set text value, current token can have no text value" );
+
+    private void setTextValue(Object src, int off, int cch) {
+        if (!_cur.isNode()) {
+            throw new IllegalStateException("Can't set text value, current token can have no text value");
         }
 
-        _cur.moveNodeContents( null, false );
+        _cur.moveNodeContents(null, false);
         _cur.next();
-        _cur.insertChars( src, off, cch );
+        _cur.insertChars(src, off, cch);
         _cur.toParent();
     }
-    
-    public void _setTextValue ( String text )
-    {
+
+    public void _setTextValue(String text) {
         if (text == null)
             text = "";
-        
-        setTextValue( text, 0, text.length() );
+
+        setTextValue(text, 0, text.length());
     }
-    
-    public void _setTextValue ( char[] sourceChars, int offset, int length )
-    {
+
+    public void _setTextValue(char[] sourceChars, int offset, int length) {
         if (length < 0)
-            throw new IndexOutOfBoundsException( "setTextValue: length < 0" );
-        
-        if (sourceChars == null)
-        {
+            throw new IndexOutOfBoundsException("setTextValue: length < 0");
+
+        if (sourceChars == null) {
             if (length > 0)
-                throw new IllegalArgumentException( "setTextValue: sourceChars == null" );
-            
-            setTextValue( null, 0, 0 );
+                throw new IllegalArgumentException("setTextValue: sourceChars == null");
+
+            setTextValue(null, 0, 0);
 
             return;
         }
-        
+
         if (offset < 0 || offset >= sourceChars.length)
-            throw new IndexOutOfBoundsException( "setTextValue: offset out of bounds" );
-        
+            throw new IndexOutOfBoundsException("setTextValue: offset out of bounds");
+
         if (offset + length > sourceChars.length)
             length = sourceChars.length - offset;
-        
+
         CharUtil cu = _cur._locale.getCharUtil();
-        
-        setTextValue( cu.saveChars( sourceChars, offset, length ), cu._offSrc, cu._cchSrc );
+
+        setTextValue(cu.saveChars(sourceChars, offset, length), cu._offSrc, cu._cchSrc);
     }
-    
-    public String _getChars ( )
-    {
-        return _cur.getCharsAsString( -1 );
+
+    public String _getChars() {
+        return _cur.getCharsAsString(-1);
     }
-    
-    public int _getChars ( char[] buf, int off, int cch )
-    {
+
+    public int _getChars(char[] buf, int off, int cch) {
         int cchRight = _cur.cchRight();
 
         if (cch < 0 || cch > cchRight)
             cch = cchRight;
-        
+
         if (buf == null || off >= buf.length)
             return 0;
 
         if (buf.length - off < cch)
             cch = buf.length - off;
 
-        Object src = _cur.getChars( cch );
-        
-        CharUtil.getChars( buf, off, src, _cur._offSrc, _cur._cchSrc );
+        Object src = _cur.getChars(cch);
+
+        CharUtil.getChars(buf, off, src, _cur._offSrc, _cur._cchSrc);
 
         return _cur._cchSrc;
     }
-    
-    public void _toStartDoc ( )
-    {
-        while ( _cur.toParent() )
+
+    public void _toStartDoc() {
+        while (_cur.toParent())
             ;
     }
-    
-    public void _toEndDoc ( )
-    {
+
+    public void _toEndDoc() {
         _toStartDoc();
-        
+
         _cur.toEnd();
     }
-    
-    public int _comparePosition ( Cursor other )
-    {
-        int s = _cur.comparePosition( other._cur );
+
+    public int _comparePosition(Cursor other) {
+        int s = _cur.comparePosition(other._cur);
 
         if (s == 2)
-            throw new IllegalArgumentException( "Cursors not in same document" );
+            throw new IllegalArgumentException("Cursors not in same document");
 
         assert s >= -1 && s <= 1;
 
         return s;
     }
-    
-    public boolean _isLeftOf ( Cursor other )
-    {
-        return _comparePosition( other ) < 0;
+
+    public boolean _isLeftOf(Cursor other) {
+        return _comparePosition(other) < 0;
     }
-    
-    public boolean _isAtSamePositionAs ( Cursor other )
-    {
-        return _cur.isSamePos( other._cur );
+
+    public boolean _isAtSamePositionAs(Cursor other) {
+        return _cur.isSamePos(other._cur);
     }
-    
-    public boolean _isRightOf ( Cursor other )
-    {
-        return _comparePosition( other ) > 0;
+
+    public boolean _isRightOf(Cursor other) {
+        return _comparePosition(other) > 0;
     }
-    
-    public XmlCursor _execQuery ( String query )
-    {
-        throw new RuntimeException( "Not implemented" );
+
+    public XmlCursor _execQuery(String query) {
+        return _execQuery(query, null);
     }
-    
-    public XmlCursor _execQuery ( String query, XmlOptions options )
-    {
-        throw new RuntimeException( "Not implemented" );
+
+    public XmlCursor _execQuery(String query, XmlOptions options) {
+            checkThisCursor();
+            return Query.cursorExecQuery(_cur,query,options);
+
     }
-    
-    public boolean _toBookmark ( XmlBookmark bookmark )
-    {
+
+
+    public boolean _toBookmark(XmlBookmark bookmark) {
         if (bookmark == null || !(bookmark._currentMark instanceof Xobj.Bookmark))
-              return false;
+            return false;
 
         Xobj.Bookmark m = (Xobj.Bookmark) bookmark._currentMark;
 
         if (m._xobj == null || m._xobj._locale != _cur._locale)
             return false;
 
-        _cur.moveTo( m._xobj, m._pos );
+        _cur.moveTo(m._xobj, m._pos);
 
         return true;
     }
-    
-    public XmlBookmark _toNextBookmark ( Object key )
-    {
+
+    public XmlBookmark _toNextBookmark(Object key) {
         if (key == null)
             return null;
 
         int cch;
 
         _cur.push();
-        
-        for ( ; ; )
-        {
+
+        for (; ;) {
             // Move a minimal amount.  If at text, move to a potential bookmark in the text.
             
-            if ((cch = _cur.cchRight()) > 1)
-            {
-                _cur.nextChars( 1 );
-                _cur.nextChars( (cch = _cur.firstBookmarkInChars( key, cch - 1 )) >= 0 ? cch : -1 );
-            }
-            else if (_toNextToken().isNone())
-            {
+            if ((cch = _cur.cchRight()) > 1) {
+                _cur.nextChars(1);
+                _cur.nextChars((cch = _cur.firstBookmarkInChars(key, cch - 1)) >= 0 ? cch : -1);
+            } else if (_toNextToken().isNone()) {
                 _cur.pop();
                 return null;
             }
-            
-            XmlBookmark bm = getBookmark( key, _cur );
 
-            if (bm != null)
-            {
+            XmlBookmark bm = getBookmark(key, _cur);
+
+            if (bm != null) {
                 _cur.popButStay();
                 return bm;
             }
 
-            if (_cur.kind() == -ROOT)
-            {
+            if (_cur.kind() == -ROOT) {
                 _cur.pop();
                 return null;
             }
         }
     }
-    
-    public XmlBookmark _toPrevBookmark ( Object key )
-    {
+
+    public XmlBookmark _toPrevBookmark(Object key) {
         if (key == null)
             return null;
 
@@ -1423,231 +1353,203 @@
 
         _cur.push();
 
-        for ( ; ; )
-        {
+        for (; ;) {
             // Move a minimal amount.  If at text, move to a potential bookmark in the text.
             
-            if ((cch = _cur.cchLeft()) > 1)
-            {
-                _cur.prevChars( 1 );
-                
-                _cur.prevChars(
-                    (cch = _cur.firstBookmarkInCharsLeft( key, cch - 1 )) >= 0 ? cch : -1 );
-            }
-            else if (cch == 1)
-            {
+            if ((cch = _cur.cchLeft()) > 1) {
+                _cur.prevChars(1);
+
+                _cur.prevChars((cch = _cur.firstBookmarkInCharsLeft(key, cch - 1)) >= 0 ? cch : -1);
+            } else if (cch == 1) {
                 // _toPrevToken will not skip to the beginning of the text, it will go further
                 // so that the token to the right is not text.  I need to simply skip to
                 // the beginning of the text ...
                 
-                _cur.prevChars( 1 );
-            }
-            else if (_toPrevToken().isNone())
-            {
+                _cur.prevChars(1);
+            } else if (_toPrevToken().isNone()) {
                 _cur.pop();
                 return null;
             }
-            
-            XmlBookmark bm = getBookmark( key, _cur );
 
-            if (bm != null)
-            {
+            XmlBookmark bm = getBookmark(key, _cur);
+
+            if (bm != null) {
                 _cur.popButStay();
                 return bm;
             }
 
-            if (_cur.kind() == ROOT)
-            {
+            if (_cur.kind() == ROOT) {
                 _cur.pop();
                 return null;
             }
         }
     }
-    
-    public void _setBookmark ( XmlBookmark bookmark )
-    {
-        if (bookmark != null)
-        {
+
+    public void _setBookmark(XmlBookmark bookmark) {
+        if (bookmark != null) {
             if (bookmark.getKey() == null)
-                throw new IllegalArgumentException( "Annotation key is null" );
+                throw new IllegalArgumentException("Annotation key is null");
             
             // TODO - I Don't do weak bookmarks yet ... perhaps I'll never do them ....
 
-            bookmark._currentMark = _cur.setBookmark( bookmark.getKey(), bookmark );
+            bookmark._currentMark = _cur.setBookmark(bookmark.getKey(), bookmark);
         }
     }
-    
-    static XmlBookmark getBookmark ( Object key, Cur c )
-    {
+
+    static XmlBookmark getBookmark(Object key, Cur c) {
         // TODO - I Don't do weak bookmarks yet ...
 
         if (key == null)
             return null;
 
-        Object bm = c.getBookmark( key );
+        Object bm = c.getBookmark(key);
 
         return bm != null && bm instanceof XmlBookmark ? (XmlBookmark) bm : null;
     }
-    
-    public XmlBookmark _getBookmark ( Object key )
-    {
-        return key == null ? null : getBookmark( key, _cur );
+
+    public XmlBookmark _getBookmark(Object key) {
+        return key == null ? null : getBookmark(key, _cur);
     }
-    
-    public void _clearBookmark ( Object key )
-    {
+
+    public void _clearBookmark(Object key) {
         if (key != null)
-            _cur.setBookmark( key, null );
+            _cur.setBookmark(key, null);
     }
-    
-    public void _getAllBookmarkRefs ( Collection listToFill )
-    {
-        if (listToFill != null)
-        {
-            for ( Xobj.Bookmark b = _cur._xobj._bookmarks ; b != null ; b = b._next )
+
+    public void _getAllBookmarkRefs(Collection listToFill) {
+        if (listToFill != null) {
+            for (Xobj.Bookmark b = _cur._xobj._bookmarks; b != null; b = b._next)
                 if (b._value instanceof XmlBookmark)
-                    listToFill.add( b._value );
+                    listToFill.add(b._value);
         }
     }
-    
-    public boolean _removeXml ( )
-    {
+
+    public boolean _removeXml() {
         if (_cur.isRoot())
-            throw new IllegalStateException( "Can't remove a whole document." );
+            throw new IllegalStateException("Can't remove a whole document.");
 
         if (_cur.isFinish())
             return false;
 
         assert _cur.isText() || _cur.isNode();
-            
+
         if (_cur.isText())
-            _cur.moveChars( null, -1 );
+            _cur.moveChars(null, -1);
         else
-            _cur.moveNode( null );
+            _cur.moveNode(null);
 
         return true;
     }
-    
-    public boolean _moveXml ( Cursor to )
-    {
-        to.checkInsertionValidity( _cur );
+
+    public boolean _moveXml(Cursor to) {
+        to.checkInsertionValidity(_cur);
 
         // Check for a no-op
         
-        if (_cur.isText())
-        {
+        if (_cur.isText()) {
             int cchRight = _cur.cchRight();
 
             assert cchRight > 0;
-            
-            if (_cur.inChars( to._cur, cchRight, true ))
+
+            if (_cur.inChars(to._cur, cchRight, true))
                 return false;
 
-            _cur.moveChars( to._cur, cchRight );
+            _cur.moveChars(to._cur, cchRight);
 
-            to._cur.nextChars( cchRight );
+            to._cur.nextChars(cchRight);
 
             return true;
         }
 
-        if (_cur.contains( to._cur ))
+        if (_cur.contains(to._cur))
             return false;
 
         // Make a cur which will float to the right of the insertion
         
         Cur c = to.tempCur();
 
-        _cur.moveNode( to._cur );
+        _cur.moveNode(to._cur);
 
-        to._cur.moveToCur( c );
+        to._cur.moveToCur(c);
 
         c.release();
 
         return true;
     }
-    
-    public boolean _copyXml ( Cursor to )
-    {
-        to.checkInsertionValidity( _cur );
+
+    public boolean _copyXml(Cursor to) {
+        to.checkInsertionValidity(_cur);
 
         assert _cur.isText() || _cur.isNode();
 
         Cur c = to.tempCur();
 
         if (_cur.isText())
-            to._cur.insertChars( _cur.getChars( -1 ), _cur._offSrc, _cur._cchSrc );
+            to._cur.insertChars(_cur.getChars(-1), _cur._offSrc, _cur._cchSrc);
         else
-            _cur.copyNode( to._cur );
+            _cur.copyNode(to._cur);
 
-        to._cur.moveToCur( c );
+        to._cur.moveToCur(c);
 
         c.release();
-                
+
         return true;
     }
-    
-    public boolean _removeXmlContents ( )
-    {
+
+    public boolean _removeXmlContents() {
         if (!_cur.isContainer())
             return false;
 
-        _cur.moveNodeContents( null, false );
+        _cur.moveNodeContents(null, false);
 
         return true;
     }
 
-    private boolean checkContentInsertionValidity ( Cursor to )
-    {
+    private boolean checkContentInsertionValidity(Cursor to) {
         _cur.push();
 
         _cur.next();
 
-        if (_cur.isFinish())
-        {
+        if (_cur.isFinish()) {
             _cur.pop();
             return false;
         }
 
-        try
-        {
-            to.checkInsertionValidity( _cur );
-        }
-        catch ( IllegalArgumentException e )
-        {
+        try {
+            to.checkInsertionValidity(_cur);
+        } catch (IllegalArgumentException e) {
             _cur.pop();
             throw e;
         }
-        
+
         _cur.pop();
 
         return true;
     }
-    
-    public boolean _moveXmlContents ( Cursor to )
-    {
-        if (!_cur.isContainer() || _cur.contains( to._cur ))
+
+    public boolean _moveXmlContents(Cursor to) {
+        if (!_cur.isContainer() || _cur.contains(to._cur))
             return false;
 
-        if (!checkContentInsertionValidity( to ))
+        if (!checkContentInsertionValidity(to))
             return false;
 
         Cur c = to.tempCur();
 
-        _cur.moveNodeContents( to._cur, false );
+        _cur.moveNodeContents(to._cur, false);
 
-        to._cur.moveToCur( c );
+        to._cur.moveToCur(c);
 
         c.release();
 
         return true;
     }
-    
-    public boolean _copyXmlContents ( Cursor to )
-    {
-        if (!_cur.isContainer() || _cur.contains( to._cur ))
+
+    public boolean _copyXmlContents(Cursor to) {
+        if (!_cur.isContainer() || _cur.contains(to._cur))
             return false;
-        
-        if (!checkContentInsertionValidity( to ))
+
+        if (!checkContentInsertionValidity(to))
             return false;
 
         // I don't have a primitive to copy contents, make a copy of the node and them move the
@@ -1655,89 +1557,82 @@
 
         Cur c = _cur._locale.tempCur();
 
-        _cur.copyNode( c );
+        _cur.copyNode(c);
 
         Cur c2 = to._cur.tempCur();
 
-        c.moveNodeContents( to._cur, false );
+        c.moveNodeContents(to._cur, false);
 
         c.release();
 
-        to._cur.moveToCur( c2 );
+        to._cur.moveToCur(c2);
 
         c2.release();
-        
+
         return true;
     }
-    
-    public int _removeChars ( int cch )
-    {
+
+    public int _removeChars(int cch) {
         int cchRight = _cur.cchRight();
-        
+
         if (cchRight == 0 || cch == 0)
             return 0;
-        
+
         if (cch < 0 || cch > cchRight)
             cch = cchRight;
-        
-        _cur.moveChars( null, cch );
+
+        _cur.moveChars(null, cch);
 
         return _cur._cchSrc;
     }
-    
-    public int _moveChars ( int cch, Cursor to )
-    {
+
+    public int _moveChars(int cch, Cursor to) {
         int cchRight = _cur.cchRight();
-        
+
         if (cchRight <= 0 || cch == 0)
             return 0;
 
         if (cch < 0 || cch > cchRight)
             cch = cchRight;
-        
-        to.checkInsertionValidity( _cur );
 
-        _cur.moveChars( to._cur, cch );
+        to.checkInsertionValidity(_cur);
+
+        _cur.moveChars(to._cur, cch);
 
-        to._cur.nextChars( _cur._cchSrc );
+        to._cur.nextChars(_cur._cchSrc);
 
         return _cur._cchSrc;
     }
-    
-    public int _copyChars ( int cch, Cursor to )
-    {
+
+    public int _copyChars(int cch, Cursor to) {
         int cchRight = _cur.cchRight();
-        
+
         if (cchRight <= 0 || cch == 0)
             return 0;
 
         if (cch < 0 || cch > cchRight)
             cch = cchRight;
 
-        to.checkInsertionValidity( _cur );
-        
-        to._cur.insertChars( _cur.getChars( cch ), _cur._offSrc, _cur._cchSrc );
+        to.checkInsertionValidity(_cur);
+
+        to._cur.insertChars(_cur.getChars(cch), _cur._offSrc, _cur._cchSrc);
+
+        to._cur.nextChars(_cur._cchSrc);
 
-        to._cur.nextChars( _cur._cchSrc );
-        
         return _cur._cchSrc;
     }
-    
-    public void _insertChars ( String text )
-    {
+
+    public void _insertChars(String text) {
         int l = text == null ? 0 : text.length();
-        
-        if (l > 0)
-        {
-            if (_cur.isRoot() || _cur.isAttr())
-            {
+
+        if (l > 0) {
+            if (_cur.isRoot() || _cur.isAttr()) {
                 throw
-                    new IllegalStateException(
-                        "Can't insert before the document or an attribute." );
+                        new IllegalStateException("Can't insert before the document or an attribute.");
             }
 
-            _cur.insertChars( text, 0, l );
-            _cur.nextChars( l );
+            _cur.insertChars(text, 0, l);
+            _cur.nextChars(l);
         }
     }
 
@@ -1745,30 +1640,51 @@
     // Inserting elements
     //
     
-    public void _beginElement          ( String localName                          ) { _insertElementWithText( localName, null, null ); _toPrevToken(); }
-    public void _beginElement          ( String localName, String uri              ) { _insertElementWithText( localName, uri, null ); _toPrevToken(); }
-    public void _beginElement          ( QName  name                               ) { _insertElementWithText( name, null ); _toPrevToken(); }
-    public void _insertElement         ( String localName                          ) { _insertElementWithText( localName, null, null ); }
-    public void _insertElement         ( String localName, String uri              ) { _insertElementWithText( localName, uri, null ); }
-    public void _insertElement         ( QName  name                               ) { _insertElementWithText( name, null ); }
-    public void _insertElementWithText ( String localName, String text             ) { _insertElementWithText( localName, null, text ); }
-    
-    public void _insertElementWithText ( String localName, String uri, String text )
-    {
-        validateLocalName( localName );
-        
-        _insertElementWithText( _cur._locale.makeQName( uri, localName ), text );
+    public void _beginElement(String localName) {
+        _insertElementWithText(localName, null, null);
+        _toPrevToken();
+    }
+
+    public void _beginElement(String localName, String uri) {
+        _insertElementWithText(localName, uri, null);
+        _toPrevToken();
+    }
+
+    public void _beginElement(QName name) {
+        _insertElementWithText(name, null);
+        _toPrevToken();
+    }
+
+    public void _insertElement(String localName) {
+        _insertElementWithText(localName, null, null);
+    }
+
+    public void _insertElement(String localName, String uri) {
+        _insertElementWithText(localName, uri, null);
+    }
+
+    public void _insertElement(QName name) {
+        _insertElementWithText(name, null);
+    }
+
+    public void _insertElementWithText(String localName, String text) {
+        _insertElementWithText(localName, null, text);
+    }
+
+    public void _insertElementWithText(String localName, String uri, String text) {
+        validateLocalName(localName);
+
+        _insertElementWithText(_cur._locale.makeQName(uri, localName), text);
     }
-    
-    public void _insertElementWithText ( QName name, String text )
-    {
-        validateLocalName( name.getLocalPart() );
+
+    public void _insertElementWithText(QName name, String text) {
+        validateLocalName(name.getLocalPart());
 
         Cur c = _cur._locale.tempCur();
 
-        c.createElement( name );
+        c.createElement(name);
 
-        insertNode( c, text );
+        insertNode(c, text);
 
         c.release();
     }
@@ -1777,28 +1693,37 @@
     //
     //
     
-    public void _insertAttribute          ( String localName )                           { _insertAttributeWithValue( localName, null ); }
-    public void _insertAttribute          ( String localName, String uri )               { _insertAttributeWithValue( localName, uri, null ); }
-    public void _insertAttribute          ( QName name )                                 { _insertAttributeWithValue( name, null ); }
-    public void _insertAttributeWithValue ( String localName, String value )             { _insertAttributeWithValue( localName, null, value ); }
-    
-    public void _insertAttributeWithValue ( String localName, String uri, String value )
-    {
-        validateLocalName( localName );
-        
-        _insertAttributeWithValue( _cur._locale.makeQName( uri, localName ), value );
+    public void _insertAttribute(String localName) {
+        _insertAttributeWithValue(localName, null);
+    }
+
+    public void _insertAttribute(String localName, String uri) {
+        _insertAttributeWithValue(localName, uri, null);
+    }
+
+    public void _insertAttribute(QName name) {
+        _insertAttributeWithValue(name, null);
     }
-    
-    public void _insertAttributeWithValue ( QName name, String text )
-    {
-        validateLocalName( name.getLocalPart() );
+
+    public void _insertAttributeWithValue(String localName, String value) {
+        _insertAttributeWithValue(localName, null, value);
+    }
+
+    public void _insertAttributeWithValue(String localName, String uri, String value) {
+        validateLocalName(localName);
+
+        _insertAttributeWithValue(_cur._locale.makeQName(uri, localName), value);
+    }
+
+    public void _insertAttributeWithValue(QName name, String text) {
+        validateLocalName(name.getLocalPart());
 
         Cur c = _cur._locale.tempCur();
 
-        c.createAttr( name );
+        c.createAttr(name);
+
+        insertNode(c, text);
 
-        insertNode( c, text );
-        
         c.release();
     }
 
@@ -1806,40 +1731,36 @@
     //
     //
     
-    public void _insertNamespace ( String prefix, String namespace )
-    {
-        _insertAttributeWithValue( _cur._locale.createXmlns( prefix ), namespace );
+    public void _insertNamespace(String prefix, String namespace) {
+        _insertAttributeWithValue(_cur._locale.createXmlns(prefix), namespace);
     }
-    
-    public void _insertComment ( String text )
-    {
+
+    public void _insertComment(String text) {
         Cur c = _cur._locale.tempCur();
 
         c.createComment();
-        
-        insertNode( c, text );
-        
+
+        insertNode(c, text);
+
         c.release();
     }
-    
-    public void _insertProcInst ( String target, String text )
-    {
-        validateLocalName( target );
 
-        if (Locale.beginsWithXml( target ) && target.length() == 3)
-            throw new IllegalArgumentException( "Target is 'xml'" );
-        
+    public void _insertProcInst(String target, String text) {
+        validateLocalName(target);
+
+        if (Locale.beginsWithXml(target) && target.length() == 3)
+            throw new IllegalArgumentException("Target is 'xml'");
+
         Cur c = _cur._locale.tempCur();
 
-        c.createProcinst( target );
+        c.createProcinst(target);
+
+        insertNode(c, text);
 
-        insertNode( c, text );
-        
         c.release();
     }
-    
-    public void _dump ( )
-    {
+
+    public void _dump() {
         _cur.dump();
     }
 
@@ -1851,26 +1772,24 @@
     //
     //
 
-    private void checkThisCursor ( )
-    {
+    private void checkThisCursor() {
         if (_cur == null)
-            throw new IllegalStateException( "This cursor has been disposed" );
+            throw new IllegalStateException("This cursor has been disposed");
     }
-    
-    private Cursor checkCursors ( XmlCursor xOther )
-    {
+
+    private Cursor checkCursors(XmlCursor xOther) {
         checkThisCursor();
 
         if (xOther == null)
-            throw new IllegalArgumentException( "Other cursor is <null>" );
-        
+            throw new IllegalArgumentException("Other cursor is <null>");
+
         if (!(xOther instanceof Cursor))
-            throw new IllegalArgumentException( "Incompatible cursors: " + xOther );
-            
+            throw new IllegalArgumentException("Incompatible cursors: " + xOther);
+
         Cursor other = (Cursor) xOther;
-        
+
         if (other._cur == null)
-            throw new IllegalStateException( "Other cursor has been disposed" );
+            throw new IllegalStateException("Other cursor has been disposed");
 
         return other;
     }
@@ -1879,137 +1798,116 @@
     // The following operations have two cursors, and can be in different documents
     //
 
-    private static final int MOVE_XML          = 0;
-    private static final int COPY_XML          = 1;
+    private static final int MOVE_XML = 0;
+    private static final int COPY_XML = 1;
     private static final int MOVE_XML_CONTENTS = 2;
     private static final int COPY_XML_CONTENTS = 3;
-    private static final int MOVE_CHARS        = 4;
-    private static final int COPY_CHARS        = 5;
-    
-    private int twoLocaleOp ( XmlCursor xOther, int op, int arg )
-    {
-        Cursor other = checkCursors( xOther );
+    private static final int MOVE_CHARS = 4;
+    private static final int COPY_CHARS = 5;
+
+    private int twoLocaleOp(XmlCursor xOther, int op, int arg) {
+        Cursor other = checkCursors(xOther);
 
         Locale locale = _cur._locale;
         Locale otherLocale = other._cur._locale;
-        
-        if (locale == otherLocale)
-        {
+
+        if (locale == otherLocale) {
             if (locale.noSync())
-                return twoLocaleOp( other, op, arg );
-            else
-            {
-                synchronized ( locale )
-                {
-                    return twoLocaleOp( other, op, arg );
+                return twoLocaleOp(other, op, arg);
+            else {
+                synchronized (locale) {
+                    return twoLocaleOp(other, op, arg);
                 }
             }
         }
-        
-        if (locale.noSync())
-        {
+
+        if (locale.noSync()) {
             if (otherLocale.noSync())
-                return twoLocaleOp( other, op, arg );
-            else
-            {
-                synchronized ( otherLocale )
-                {
-                    return twoLocaleOp( other, op, arg );
+                return twoLocaleOp(other, op, arg);
+            else {
+                synchronized (otherLocale) {
+                    return twoLocaleOp(other, op, arg);
                 }
             }
-        }
-        else if (otherLocale.noSync())
-        {
-            synchronized ( locale )
-            {
-                return twoLocaleOp( other, op, arg );
+        } else if (otherLocale.noSync()) {
+            synchronized (locale) {
+                return twoLocaleOp(other, op, arg);
             }
         }
-        
+
         boolean acquired = false;
 
-        try
-        {
+        try {
             GlobalLock.acquire();
             acquired = true;
-            
-            synchronized ( locale )
-            {
-                synchronized ( otherLocale )
-                {
+
+            synchronized (locale) {
+                synchronized (otherLocale) {
                     GlobalLock.release();
                     acquired = false;
-                    
-                    return twoLocaleOp( other, op, arg );
+
+                    return twoLocaleOp(other, op, arg);
                 }
             }
-        }
-        catch ( InterruptedException e )
-        {
-            throw new RuntimeException( e.getMessage(), e );
-        }
-        finally
-        {
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        } finally {
             if (acquired)
                 GlobalLock.release();
         }
     }
-    
-    private int twoLocaleOp ( Cursor other, int op, int arg )
-    {
+
+    private int twoLocaleOp(Cursor other, int op, int arg) {
         Locale locale = _cur._locale;
         Locale otherLocale = other._cur._locale;
-        
-        locale.enter( otherLocale );
-        
-        try
-        {
-            switch ( op )
-            {
-                case MOVE_XML          : return _moveXml         ( other ) ? 1 : 0;
-                case COPY_XML          : return _copyXml         ( other ) ? 1 : 0;
-                case MOVE_XML_CONTENTS : return _moveXmlContents ( other ) ? 1 : 0;
-                case COPY_XML_CONTENTS : return _copyXmlContents ( other ) ? 1 : 0;
-                case MOVE_CHARS        : return _moveChars       ( arg, other );
-                case COPY_CHARS        : return _copyChars       ( arg, other );
-                                         
-                default : throw new RuntimeException( "Unknown operation: " + op );
-            }
-        }
-        finally
-        {
-            locale.exit( otherLocale );
+
+        locale.enter(otherLocale);
+
+        try {
+            switch (op) {
+                case MOVE_XML:
+                    return _moveXml(other) ? 1 : 0;
+                case COPY_XML:
+                    return _copyXml(other) ? 1 : 0;
+                case MOVE_XML_CONTENTS:
+                    return _moveXmlContents(other) ? 1 : 0;
+                case COPY_XML_CONTENTS:
+                    return _copyXmlContents(other) ? 1 : 0;
+                case MOVE_CHARS:
+                    return _moveChars(arg, other);
+                case COPY_CHARS:
+                    return _copyChars(arg, other);
+
+                default :
+                    throw new RuntimeException("Unknown operation: " + op);
+            }
+        } finally {
+            locale.exit(otherLocale);
         }
     }
-    
-    public boolean moveXml ( XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, MOVE_XML, 0 ) == 1;
+
+    public boolean moveXml(XmlCursor xTo) {
+        return twoLocaleOp(xTo, MOVE_XML, 0) == 1;
     }
-    
-    public boolean copyXml ( XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, COPY_XML, 0 ) == 1;
+
+    public boolean copyXml(XmlCursor xTo) {
+        return twoLocaleOp(xTo, COPY_XML, 0) == 1;
     }
-    
-    public boolean moveXmlContents ( XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, MOVE_XML_CONTENTS, 0 ) == 1;
+
+    public boolean moveXmlContents(XmlCursor xTo) {
+        return twoLocaleOp(xTo, MOVE_XML_CONTENTS, 0) == 1;
     }
-    
-    public boolean copyXmlContents ( XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, COPY_XML_CONTENTS, 0 ) == 1;
+
+    public boolean copyXmlContents(XmlCursor xTo) {
+        return twoLocaleOp(xTo, COPY_XML_CONTENTS, 0) == 1;
     }
-    
-    public int moveChars ( int cch, XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, MOVE_CHARS, cch );
+
+    public int moveChars(int cch, XmlCursor xTo) {
+        return twoLocaleOp(xTo, MOVE_CHARS, cch);
     }
-    
-    public int copyChars ( int cch, XmlCursor xTo )
-    {
-        return twoLocaleOp( xTo, COPY_CHARS, cch );
+
+    public int copyChars(int cch, XmlCursor xTo) {
+        return twoLocaleOp(xTo, COPY_CHARS, cch);
     }
 
     //
@@ -2017,190 +1915,2400 @@
     // require sync on both locales.
     //
 
-    public boolean toCursor ( XmlCursor xOther )
-    {
+    public boolean toCursor(XmlCursor xOther) {
         // One may only move cursors within the same locale
         
-        Cursor other = checkCursors( xOther );
+        Cursor other = checkCursors(xOther);
 
         if (_cur._locale != other._cur._locale)
             return false;
 
-        if (_cur._locale.noSync()) { _cur._locale.enter(); try { return _toCursor( other ); } finally { _cur._locale.exit(); } } else { synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toCursor( other ); } finally { _cur._locale.exit(); } } }
+        if (_cur._locale.noSync()) {
+            _cur._locale.enter();
+            try {
+                return _toCursor(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else {
+            synchronized (_cur._locale) {
+                _cur._locale.enter();
+                try {
+                    return _toCursor(other);
+                } finally {
+                    _cur._locale.exit();
+                }
+            }
+        }
     }
-    
-    public boolean isInSameDocument ( XmlCursor xOther )
-    {
-        return xOther == null ? false : _cur.isInSameTree( checkCursors( xOther )._cur );
+
+    public boolean isInSameDocument(XmlCursor xOther) {
+        return xOther == null ? false : _cur.isInSameTree(checkCursors(xOther)._cur);
     }
 
     //
     // The following operations have two cursors, but they must be in the same document
     //
 
-    private Cursor preCheck ( XmlCursor xOther )
-    {
-        Cursor other = checkCursors( xOther );
+    private Cursor preCheck(XmlCursor xOther) {
+        Cursor other = checkCursors(xOther);
 
         if (_cur._locale != other._cur._locale)
-            throw new IllegalArgumentException( "Cursors not in same document" );
-        
+            throw new IllegalArgumentException("Cursors not in same document");
+
         return other;
     }
 
-    public int comparePosition ( XmlCursor xOther ) { Cursor other = preCheck( xOther ); if (_cur._locale.noSync()) { _cur._locale.enter(); try { return _comparePosition( other ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _comparePosition( other ); } finally { _cur._locale.exit(); } } }
-    public boolean isLeftOf ( XmlCursor xOther ) { Cursor other = preCheck( xOther ); if (_cur._locale.noSync()) { _cur._locale.enter(); try { return _isLeftOf( other ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isLeftOf( other ); } finally { _cur._locale.exit(); } } }
-    public boolean isAtSamePositionAs ( XmlCursor xOther ) { Cursor other = preCheck( xOther ); if (_cur._locale.noSync()) { _cur._locale.enter(); try { return _isAtSamePositionAs( other ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isAtSamePositionAs( other ); } finally { _cur._locale.exit(); } } }
-    public boolean isRightOf ( XmlCursor xOther ) { Cursor other = preCheck( xOther ); if (_cur._locale.noSync()) { _cur._locale.enter(); try { return _isRightOf( other ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isRightOf( other ); } finally { _cur._locale.exit(); } } }
+    public int comparePosition(XmlCursor xOther) {
+        Cursor other = preCheck(xOther);
+        if (_cur._locale.noSync()) {
+            _cur._locale.enter();
+            try {
+                return _comparePosition(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _comparePosition(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isLeftOf(XmlCursor xOther) {
+        Cursor other = preCheck(xOther);
+        if (_cur._locale.noSync()) {
+            _cur._locale.enter();
+            try {
+                return _isLeftOf(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isLeftOf(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isAtSamePositionAs(XmlCursor xOther) {
+        Cursor other = preCheck(xOther);
+        if (_cur._locale.noSync()) {
+            _cur._locale.enter();
+            try {
+                return _isAtSamePositionAs(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isAtSamePositionAs(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isRightOf(XmlCursor xOther) {
+        Cursor other = preCheck(xOther);
+        if (_cur._locale.noSync()) {
+            _cur._locale.enter();
+            try {
+                return _isRightOf(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isRightOf(other);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
     
     //
     // Create a cursor from an Xobj -- used for XmlBookmark.createCursor
     //
     
-    public static XmlCursor newCursor ( Xobj x, int p ) { Locale l = x._locale; if (l.noSync()) { l.enter(); try { return new Cursor( x, p ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return new Cursor( x, p ); } finally { l.exit(); } } }
+    public static XmlCursor newCursor(Xobj x, int p) {
+        Locale l = x._locale;
+        if (l.noSync()) {
+            l.enter();
+            try {
+                return new Cursor(x, p);
+            } finally {
+                l.exit();
+            }
+        } else synchronized (l) {
+            l.enter();
+            try {
+                return new Cursor(x, p);
+            } finally {
+                l.exit();
+            }
+        }
+    }
     
     //
     // The following operations involve only one cursor
     //
 
-    private boolean preCheck ( )
-    {
+    private boolean preCheck() {
         checkThisCursor();
         return _cur._locale.noSync();
     }
 
-    public void dispose ( ) { if (_cur != null) { Locale l = _cur._locale; if (preCheck()) { l.enter(); try { _dispose(); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { _dispose(); } finally { l.exit(); } } } }
-    public Object monitor ( ) { if (preCheck()) { _cur._locale.enter(); try { return _monitor(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _monitor(); } finally { _cur._locale.exit(); } } }
-    public XmlDocumentProperties documentProperties ( ) { if (preCheck()) { _cur._locale.enter(); try { return _documentProperties(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _documentProperties(); } finally { _cur._locale.exit(); } } }
-    public XmlCursor newCursor ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newCursor(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newCursor(); } finally { _cur._locale.exit(); } } }
-    public XMLStreamReader newXMLStreamReader ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newXMLStreamReader(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newXMLStreamReader(); } finally { _cur._locale.exit(); } } }
-    public XMLStreamReader newXMLStreamReader ( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _newXMLStreamReader( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newXMLStreamReader( options ); } finally { _cur._locale.exit(); } } }
-    public XMLInputStream newXMLInputStream ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newXMLInputStream(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newXMLInputStream(); } finally { _cur._locale.exit(); } } }
-    public String xmlText ( ) { if (preCheck()) { _cur._locale.enter(); try { return _xmlText(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _xmlText(); } finally { _cur._locale.exit(); } } }
-    public InputStream newInputStream ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newInputStream(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newInputStream(); } finally { _cur._locale.exit(); } } }
-    public Reader newReader ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newReader(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newReader(); } finally { _cur._locale.exit(); } } }
-    public Node newDomNode ( ) { if (preCheck()) { _cur._locale.enter(); try { return _newDomNode(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newDomNode(); } finally { _cur._locale.exit(); } } }
-    public Node getDomNode ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getDomNode(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getDomNode(); } finally { _cur._locale.exit(); } } }
-    public void save ( ContentHandler ch, LexicalHandler lh ) throws SAXException { if (preCheck()) { _cur._locale.enter(); try { _save( ch, lh ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( ch, lh ); } finally { _cur._locale.exit(); } } }
-    public void save ( File file ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( file ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( file ); } finally { _cur._locale.exit(); } } }
-    public void save ( OutputStream os ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( os ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( os ); } finally { _cur._locale.exit(); } } }
-    public void save ( Writer w ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( w ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( w ); } finally { _cur._locale.exit(); } } }
-    public XMLInputStream newXMLInputStream ( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _newXMLInputStream( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newXMLInputStream( options ); } finally { _cur._locale.exit(); } } }
-    public String xmlText ( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _xmlText( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _xmlText( options ); } finally { _cur._locale.exit(); } } }
-    public InputStream newInputStream ( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _newInputStream( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newInputStream( options ); } finally { _cur._locale.exit(); } } }
-    public Reader newReader( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _newReader( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newReader( options ); } finally { _cur._locale.exit(); } } }
-    public Node newDomNode ( XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _newDomNode( options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _newDomNode( options ); } finally { _cur._locale.exit(); } } }
-    public void save ( ContentHandler ch, LexicalHandler lh, XmlOptions options ) throws SAXException { if (preCheck()) { _cur._locale.enter(); try { _save( ch, lh, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( ch, lh, options ); } finally { _cur._locale.exit(); } } }
-    public void save ( File file, XmlOptions options ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( file, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( file, options ); } finally { _cur._locale.exit(); } } }
-    public void save ( OutputStream os, XmlOptions options ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( os, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( os, options ); } finally { _cur._locale.exit(); } } }
-    public void save ( Writer w, XmlOptions options ) throws IOException { if (preCheck()) { _cur._locale.enter(); try { _save( w, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _save( w, options ); } finally { _cur._locale.exit(); } } }
-    public void push ( ) { if (preCheck()) { _cur._locale.enter(); try { _push(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _push(); } finally { _cur._locale.exit(); } } }
-    public boolean pop ( ) { if (preCheck()) { _cur._locale.enter(); try { return _pop(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _pop(); } finally { _cur._locale.exit(); } } }
-    public void selectPath ( String path ) { if (preCheck()) { _cur._locale.enter(); try { _selectPath( path ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _selectPath( path ); } finally { _cur._locale.exit(); } } }
-    public void selectPath ( String path, XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { _selectPath( path, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _selectPath( path, options ); } finally { _cur._locale.exit(); } } }
-    public boolean hasNextSelection ( ) { if (preCheck()) { _cur._locale.enter(); try { return _hasNextSelection(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _hasNextSelection(); } finally { _cur._locale.exit(); } } }
-    public boolean toNextSelection ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextSelection(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextSelection(); } finally { _cur._locale.exit(); } } }
-    public boolean toSelection ( int i ) { if (preCheck()) { _cur._locale.enter(); try { return _toSelection( i ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toSelection( i ); } finally { _cur._locale.exit(); } } }
-    public int getSelectionCount ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getSelectionCount(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getSelectionCount(); } finally { _cur._locale.exit(); } } }
-    public void addToSelection ( ) { if (preCheck()) { _cur._locale.enter(); try { _addToSelection(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _addToSelection(); } finally { _cur._locale.exit(); } } }
-    public void clearSelections ( ) { if (preCheck()) { _cur._locale.enter(); try { _clearSelections(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _clearSelections(); } finally { _cur._locale.exit(); } } }
-    public boolean toBookmark ( XmlBookmark bookmark ) { if (preCheck()) { _cur._locale.enter(); try { return _toBookmark( bookmark ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toBookmark( bookmark ); } finally { _cur._locale.exit(); } } }
-    public XmlBookmark toNextBookmark ( Object key ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextBookmark( key ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextBookmark( key ); } finally { _cur._locale.exit(); } } }
-    public XmlBookmark toPrevBookmark ( Object key ) { if (preCheck()) { _cur._locale.enter(); try { return _toPrevBookmark( key ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toPrevBookmark( key ); } finally { _cur._locale.exit(); } } }
-    public QName getName ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getName(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getName(); } finally { _cur._locale.exit(); } } }
-    public void setName ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { _setName( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _setName( name ); } finally { _cur._locale.exit(); } } }
-    public String namespaceForPrefix ( String prefix ) { if (preCheck()) { _cur._locale.enter(); try { return _namespaceForPrefix( prefix ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _namespaceForPrefix( prefix ); } finally { _cur._locale.exit(); } } }
-    public String prefixForNamespace ( String namespaceURI ) { if (preCheck()) { _cur._locale.enter(); try { return _prefixForNamespace( namespaceURI ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _prefixForNamespace( namespaceURI ); } finally { _cur._locale.exit(); } } }
-    public void getAllNamespaces ( Map addToThis ) { if (preCheck()) { _cur._locale.enter(); try { _getAllNamespaces( addToThis ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _getAllNamespaces( addToThis ); } finally { _cur._locale.exit(); } } }
-    public XmlObject getObject ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getObject(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getObject(); } finally { _cur._locale.exit(); } } }
-    public TokenType currentTokenType ( ) { if (preCheck()) { _cur._locale.enter(); try { return _currentTokenType(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _currentTokenType(); } finally { _cur._locale.exit(); } } }
-    public boolean isStartdoc ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isStartdoc(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isStartdoc(); } finally { _cur._locale.exit(); } } }
-    public boolean isEnddoc ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isEnddoc(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isEnddoc(); } finally { _cur._locale.exit(); } } }
-    public boolean isStart ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isStart(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isStart(); } finally { _cur._locale.exit(); } } }
-    public boolean isEnd ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isEnd(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isEnd(); } finally { _cur._locale.exit(); } } }
-    public boolean isText ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isText(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isText(); } finally { _cur._locale.exit(); } } }
-    public boolean isAttr ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isAttr(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isAttr(); } finally { _cur._locale.exit(); } } }
-    public boolean isNamespace ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isNamespace(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isNamespace(); } finally { _cur._locale.exit(); } } }
-    public boolean isComment ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isComment(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isComment(); } finally { _cur._locale.exit(); } } }
-    public boolean isProcinst ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isProcinst(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isProcinst(); } finally { _cur._locale.exit(); } } }
-    public boolean isContainer ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isContainer(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isContainer(); } finally { _cur._locale.exit(); } } }
-    public boolean isFinish ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isFinish(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isFinish(); } finally { _cur._locale.exit(); } } }
-    public boolean isAnyAttr ( ) { if (preCheck()) { _cur._locale.enter(); try { return _isAnyAttr(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _isAnyAttr(); } finally { _cur._locale.exit(); } } }
-    public TokenType prevTokenType ( ) { if (preCheck()) { _cur._locale.enter(); try { return _prevTokenType(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _prevTokenType(); } finally { _cur._locale.exit(); } } }
-    public boolean hasNextToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _hasNextToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _hasNextToken(); } finally { _cur._locale.exit(); } } }
-    public boolean hasPrevToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _hasPrevToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _hasPrevToken(); } finally { _cur._locale.exit(); } } }
-    public TokenType toNextToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextToken(); } finally { _cur._locale.exit(); } } }
-    public TokenType toPrevToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toPrevToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toPrevToken(); } finally { _cur._locale.exit(); } } }
-    public TokenType toFirstContentToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toFirstContentToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toFirstContentToken(); } finally { _cur._locale.exit(); } } }
-    public TokenType toEndToken ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toEndToken(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toEndToken(); } finally { _cur._locale.exit(); } } }
-    public int toNextChar ( int cch ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextChar( cch ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextChar( cch ); } finally { _cur._locale.exit(); } } }
-    public int toPrevChar ( int cch ) { if (preCheck()) { _cur._locale.enter(); try { return _toPrevChar( cch ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toPrevChar( cch ); } finally { _cur._locale.exit(); } } }
-    public boolean toNextSibling ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextSibling(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextSibling(); } finally { _cur._locale.exit(); } } }
-    public boolean toPrevSibling ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toPrevSibling(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toPrevSibling(); } finally { _cur._locale.exit(); } } }
-    public boolean toParent ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toParent(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toParent(); } finally { _cur._locale.exit(); } } }
-    public boolean toFirstChild ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toFirstChild(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toFirstChild(); } finally { _cur._locale.exit(); } } }
-    public boolean toLastChild ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toLastChild(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toLastChild(); } finally { _cur._locale.exit(); } } }
-    public boolean toChild ( String name ) { if (preCheck()) { _cur._locale.enter(); try { return _toChild( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toChild( name ); } finally { _cur._locale.exit(); } } }
-    public boolean toChild ( String namespace, String name ) { if (preCheck()) { _cur._locale.enter(); try { return _toChild( namespace, name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toChild( namespace, name ); } finally { _cur._locale.exit(); } } }
-    public boolean toChild ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { return _toChild( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toChild( name ); } finally { _cur._locale.exit(); } } }
-    public boolean toChild ( int index ) { if (preCheck()) { _cur._locale.enter(); try { return _toChild( index ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toChild( index ); } finally { _cur._locale.exit(); } } }
-    public boolean toChild ( QName name, int index ) { if (preCheck()) { _cur._locale.enter(); try { return _toChild( name, index ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toChild( name, index ); } finally { _cur._locale.exit(); } } }
-    public boolean toNextSibling ( String name ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextSibling( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextSibling( name ); } finally { _cur._locale.exit(); } } }
-    public boolean toNextSibling ( String namespace, String name ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextSibling( namespace, name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextSibling( namespace, name ); } finally { _cur._locale.exit(); } } }
-    public boolean toNextSibling ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextSibling( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextSibling( name ); } finally { _cur._locale.exit(); } } }
-    public boolean toFirstAttribute ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toFirstAttribute(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toFirstAttribute(); } finally { _cur._locale.exit(); } } }
-    public boolean toLastAttribute ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toLastAttribute(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toLastAttribute(); } finally { _cur._locale.exit(); } } }
-    public boolean toNextAttribute ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toNextAttribute(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toNextAttribute(); } finally { _cur._locale.exit(); } } }
-    public boolean toPrevAttribute ( ) { if (preCheck()) { _cur._locale.enter(); try { return _toPrevAttribute(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _toPrevAttribute(); } finally { _cur._locale.exit(); } } }
-    public String getAttributeText ( QName attrName ) { if (preCheck()) { _cur._locale.enter(); try { return _getAttributeText( attrName ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getAttributeText( attrName ); } finally { _cur._locale.exit(); } } }
-    public boolean setAttributeText ( QName attrName, String value ) { if (preCheck()) { _cur._locale.enter(); try { return _setAttributeText( attrName, value ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _setAttributeText( attrName, value ); } finally { _cur._locale.exit(); } } }
-    public boolean removeAttribute ( QName attrName ) { if (preCheck()) { _cur._locale.enter(); try { return _removeAttribute( attrName ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _removeAttribute( attrName ); } finally { _cur._locale.exit(); } } }
-    public String getTextValue ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getTextValue(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getTextValue(); } finally { _cur._locale.exit(); } } }
-    public int getTextValue ( char[] chars, int offset, int cch ) { if (preCheck()) { _cur._locale.enter(); try { return _getTextValue( chars, offset, cch ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getTextValue( chars, offset, cch ); } finally { _cur._locale.exit(); } } }
-    public void setTextValue ( String text ) { if (preCheck()) { _cur._locale.enter(); try { _setTextValue( text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _setTextValue( text ); } finally { _cur._locale.exit(); } } }
-    public void setTextValue ( char[] sourceChars, int offset, int length ) { if (preCheck()) { _cur._locale.enter(); try { _setTextValue( sourceChars, offset, length ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _setTextValue( sourceChars, offset, length ); } finally { _cur._locale.exit(); } } }
-    public String getChars ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getChars(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getChars(); } finally { _cur._locale.exit(); } } }
-    public int getChars ( char[] chars, int offset, int cch ) { if (preCheck()) { _cur._locale.enter(); try { return _getChars( chars, offset, cch ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getChars( chars, offset, cch ); } finally { _cur._locale.exit(); } } }
-    public void toStartDoc ( ) { if (preCheck()) { _cur._locale.enter(); try { _toStartDoc(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _toStartDoc(); } finally { _cur._locale.exit(); } } }
-    public void toEndDoc ( ) { if (preCheck()) { _cur._locale.enter(); try { _toEndDoc(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _toEndDoc(); } finally { _cur._locale.exit(); } } }
-    public XmlCursor execQuery ( String query ) { if (preCheck()) { _cur._locale.enter(); try { return _execQuery( query ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _execQuery( query ); } finally { _cur._locale.exit(); } } }
-    public XmlCursor execQuery ( String query, XmlOptions options ) { if (preCheck()) { _cur._locale.enter(); try { return _execQuery( query, options ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _execQuery( query, options ); } finally { _cur._locale.exit(); } } }
-    public ChangeStamp getDocChangeStamp ( ) { if (preCheck()) { _cur._locale.enter(); try { return _getDocChangeStamp(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getDocChangeStamp(); } finally { _cur._locale.exit(); } } }
-    public void setBookmark ( XmlBookmark bookmark ) { if (preCheck()) { _cur._locale.enter(); try { _setBookmark( bookmark ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _setBookmark( bookmark ); } finally { _cur._locale.exit(); } } }
-    public XmlBookmark getBookmark ( Object key ) { if (preCheck()) { _cur._locale.enter(); try { return _getBookmark( key ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _getBookmark( key ); } finally { _cur._locale.exit(); } } }
-    public void clearBookmark ( Object key ) { if (preCheck()) { _cur._locale.enter(); try { _clearBookmark( key ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _clearBookmark( key ); } finally { _cur._locale.exit(); } } }
-    public void getAllBookmarkRefs ( Collection listToFill ) { if (preCheck()) { _cur._locale.enter(); try { _getAllBookmarkRefs( listToFill ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _getAllBookmarkRefs( listToFill ); } finally { _cur._locale.exit(); } } }
-    public boolean removeXml ( ) { if (preCheck()) { _cur._locale.enter(); try { return _removeXml(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _removeXml(); } finally { _cur._locale.exit(); } } }
-    public boolean removeXmlContents ( ) { if (preCheck()) { _cur._locale.enter(); try { return _removeXmlContents(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _removeXmlContents(); } finally { _cur._locale.exit(); } } }
-    public int removeChars ( int cch ) { if (preCheck()) { _cur._locale.enter(); try { return _removeChars( cch ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { return _removeChars( cch ); } finally { _cur._locale.exit(); } } }
-    public void insertChars ( String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertChars( text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertChars( text ); } finally { _cur._locale.exit(); } } }
-    public void insertElement ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { _insertElement( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElement( name ); } finally { _cur._locale.exit(); } } }
-    public void insertElement ( String localName ) { if (preCheck()) { _cur._locale.enter(); try { _insertElement( localName ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElement( localName ); } finally { _cur._locale.exit(); } } }
-    public void insertElement ( String localName, String uri ) { if (preCheck()) { _cur._locale.enter(); try { _insertElement( localName, uri ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElement( localName, uri ); } finally { _cur._locale.exit(); } } }
-    public void beginElement ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { _beginElement( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _beginElement( name ); } finally { _cur._locale.exit(); } } }
-    public void beginElement ( String localName ) { if (preCheck()) { _cur._locale.enter(); try { _beginElement( localName ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _beginElement( localName ); } finally { _cur._locale.exit(); } } }
-    public void beginElement ( String localName, String uri ) { if (preCheck()) { _cur._locale.enter(); try { _beginElement( localName, uri ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _beginElement( localName, uri ); } finally { _cur._locale.exit(); } } }
-    public void insertElementWithText ( QName name, String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertElementWithText( name, text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElementWithText( name, text ); } finally { _cur._locale.exit(); } } }
-    public void insertElementWithText ( String localName, String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertElementWithText( localName, text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElementWithText( localName, text ); } finally { _cur._locale.exit(); } } }
-    public void insertElementWithText ( String localName, String uri, String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertElementWithText( localName, uri, text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertElementWithText( localName, uri, text ); } finally { _cur._locale.exit(); } } }
-    public void insertAttribute ( String localName ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttribute( localName ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttribute( localName ); } finally { _cur._locale.exit(); } } }
-    public void insertAttribute ( String localName, String uri ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttribute( localName, uri ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttribute( localName, uri ); } finally { _cur._locale.exit(); } } }
-    public void insertAttribute ( QName name ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttribute( name ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttribute( name ); } finally { _cur._locale.exit(); } } }
-    public void insertAttributeWithValue ( String Name, String value ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttributeWithValue( Name, value ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttributeWithValue( Name, value ); } finally { _cur._locale.exit(); } } }
-    public void insertAttributeWithValue ( String name, String uri, String value ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttributeWithValue( name, uri, value ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttributeWithValue( name, uri, value ); } finally { _cur._locale.exit(); } } }
-    public void insertAttributeWithValue ( QName name, String value ) { if (preCheck()) { _cur._locale.enter(); try { _insertAttributeWithValue( name, value ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertAttributeWithValue( name, value ); } finally { _cur._locale.exit(); } } }
-    public void insertNamespace ( String prefix, String namespace ) { if (preCheck()) { _cur._locale.enter(); try { _insertNamespace( prefix, namespace ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertNamespace( prefix, namespace ); } finally { _cur._locale.exit(); } } }
-    public void insertComment ( String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertComment( text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertComment( text ); } finally { _cur._locale.exit(); } } }
-    public void insertProcInst ( String target, String text ) { if (preCheck()) { _cur._locale.enter(); try { _insertProcInst( target, text ); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _insertProcInst( target, text ); } finally { _cur._locale.exit(); } } }
-    public void dump ( ) { if (preCheck()) { _cur._locale.enter(); try { _dump(); } finally { _cur._locale.exit(); } } else synchronized ( _cur._locale ) { _cur._locale.enter(); try { _dump(); } finally { _cur._locale.exit(); } } }
+    public void dispose() {
+        if (_cur != null) {
+            Locale l = _cur._locale;
+            if (preCheck()) {
+                l.enter();
+                try {
+                    _dispose();
+                } finally {
+                    l.exit();
+                }
+            } else synchronized (l) {
+                l.enter();
+                try {
+                    _dispose();
+                } finally {
+                    l.exit();
+                }
+            }
+        }
+    }
+
+    public Object monitor() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _monitor();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _monitor();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlDocumentProperties documentProperties() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _documentProperties();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _documentProperties();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlCursor newCursor() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newCursor();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newCursor();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XMLStreamReader newXMLStreamReader() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newXMLStreamReader();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newXMLStreamReader();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XMLStreamReader newXMLStreamReader(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newXMLStreamReader(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newXMLStreamReader(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XMLInputStream newXMLInputStream() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newXMLInputStream();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newXMLInputStream();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String xmlText() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _xmlText();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _xmlText();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public InputStream newInputStream() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newInputStream();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newInputStream();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public Reader newReader() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newReader();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newReader();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public Node newDomNode() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newDomNode();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newDomNode();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public Node getDomNode() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getDomNode();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getDomNode();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(ContentHandler ch, LexicalHandler lh) throws SAXException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(ch, lh);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(ch, lh);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(File file) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(file);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(file);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(OutputStream os) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(os);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(os);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(Writer w) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(w);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(w);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XMLInputStream newXMLInputStream(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newXMLInputStream(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newXMLInputStream(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String xmlText(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _xmlText(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _xmlText(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public InputStream newInputStream(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newInputStream(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newInputStream(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public Reader newReader(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newReader(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newReader(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public Node newDomNode(XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _newDomNode(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _newDomNode(options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(ContentHandler ch, LexicalHandler lh, XmlOptions options) throws SAXException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(ch, lh, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(ch, lh, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(File file, XmlOptions options) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(file, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(file, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(OutputStream os, XmlOptions options) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(os, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(os, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void save(Writer w, XmlOptions options) throws IOException {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _save(w, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _save(w, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void push() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _push();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _push();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean pop() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _pop();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _pop();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void selectPath(String path) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _selectPath(path);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _selectPath(path);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void selectPath(String path, XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _selectPath(path, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _selectPath(path, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean hasNextSelection() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _hasNextSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _hasNextSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextSelection() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toSelection(int i) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toSelection(i);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toSelection(i);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int getSelectionCount() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getSelectionCount();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getSelectionCount();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void addToSelection() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _addToSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _addToSelection();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void clearSelections() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _clearSelections();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _clearSelections();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toBookmark(XmlBookmark bookmark) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toBookmark(bookmark);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toBookmark(bookmark);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlBookmark toNextBookmark(Object key) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlBookmark toPrevBookmark(Object key) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toPrevBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toPrevBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public QName getName() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getName();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getName();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void setName(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _setName(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _setName(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String namespaceForPrefix(String prefix) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _namespaceForPrefix(prefix);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _namespaceForPrefix(prefix);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String prefixForNamespace(String namespaceURI) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _prefixForNamespace(namespaceURI);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _prefixForNamespace(namespaceURI);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void getAllNamespaces(Map addToThis) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _getAllNamespaces(addToThis);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _getAllNamespaces(addToThis);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlObject getObject() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getObject();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getObject();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType currentTokenType() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _currentTokenType();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _currentTokenType();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isStartdoc() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isStartdoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isStartdoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isEnddoc() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isEnddoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isEnddoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isStart() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isStart();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isStart();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isEnd() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isEnd();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isEnd();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isText() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isText();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isText();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isAttr() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isAttr();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isAttr();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isNamespace() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isNamespace();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isNamespace();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isComment() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isComment();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isComment();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isProcinst() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isProcinst();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isProcinst();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isContainer() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isContainer();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isContainer();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isFinish() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isFinish();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isFinish();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean isAnyAttr() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _isAnyAttr();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _isAnyAttr();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType prevTokenType() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _prevTokenType();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _prevTokenType();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean hasNextToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _hasNextToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _hasNextToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean hasPrevToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _hasPrevToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _hasPrevToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType toNextToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType toPrevToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toPrevToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toPrevToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType toFirstContentToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toFirstContentToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toFirstContentToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public TokenType toEndToken() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toEndToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toEndToken();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int toNextChar(int cch) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextChar(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextChar(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int toPrevChar(int cch) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toPrevChar(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toPrevChar(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextSibling() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toPrevSibling() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toPrevSibling();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toPrevSibling();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toParent() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toParent();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toParent();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toFirstChild() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toFirstChild();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toFirstChild();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toLastChild() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toLastChild();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toLastChild();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toChild(String name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toChild(String namespace, String name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toChild(namespace, name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toChild(namespace, name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toChild(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toChild(int index) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toChild(index);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toChild(index);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toChild(QName name, int index) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name, index);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toChild(name, index);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextSibling(String name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextSibling(String namespace, String name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(namespace, name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(namespace, name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextSibling(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextSibling(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toFirstAttribute() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toFirstAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toFirstAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toLastAttribute() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toLastAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toLastAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toNextAttribute() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toNextAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toNextAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean toPrevAttribute() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _toPrevAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _toPrevAttribute();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String getAttributeText(QName attrName) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getAttributeText(attrName);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getAttributeText(attrName);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean setAttributeText(QName attrName, String value) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _setAttributeText(attrName, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _setAttributeText(attrName, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean removeAttribute(QName attrName) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _removeAttribute(attrName);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _removeAttribute(attrName);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String getTextValue() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getTextValue();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getTextValue();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int getTextValue(char[] chars, int offset, int cch) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getTextValue(chars, offset, cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getTextValue(chars, offset, cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void setTextValue(String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _setTextValue(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _setTextValue(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void setTextValue(char[] sourceChars, int offset, int length) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _setTextValue(sourceChars, offset, length);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _setTextValue(sourceChars, offset, length);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public String getChars() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getChars();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getChars();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int getChars(char[] chars, int offset, int cch) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getChars(chars, offset, cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getChars(chars, offset, cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void toStartDoc() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _toStartDoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _toStartDoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void toEndDoc() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _toEndDoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _toEndDoc();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlCursor execQuery(String query) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _execQuery(query);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _execQuery(query);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlCursor execQuery(String query, XmlOptions options) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _execQuery(query, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _execQuery(query, options);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public ChangeStamp getDocChangeStamp() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getDocChangeStamp();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getDocChangeStamp();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void setBookmark(XmlBookmark bookmark) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _setBookmark(bookmark);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _setBookmark(bookmark);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public XmlBookmark getBookmark(Object key) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _getBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _getBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void clearBookmark(Object key) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _clearBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _clearBookmark(key);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void getAllBookmarkRefs(Collection listToFill) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _getAllBookmarkRefs(listToFill);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _getAllBookmarkRefs(listToFill);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean removeXml() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _removeXml();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _removeXml();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public boolean removeXmlContents() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _removeXmlContents();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _removeXmlContents();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public int removeChars(int cch) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                return _removeChars(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                return _removeChars(cch);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertChars(String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertChars(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertChars(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElement(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElement(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElement(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElement(String localName) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElement(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElement(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElement(String localName, String uri) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElement(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElement(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void beginElement(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _beginElement(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _beginElement(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void beginElement(String localName) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _beginElement(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _beginElement(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void beginElement(String localName, String uri) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _beginElement(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _beginElement(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElementWithText(QName name, String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(name, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(name, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElementWithText(String localName, String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(localName, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(localName, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertElementWithText(String localName, String uri, String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(localName, uri, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertElementWithText(localName, uri, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttribute(String localName) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(localName);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttribute(String localName, String uri) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(localName, uri);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttribute(QName name) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttribute(name);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttributeWithValue(String Name, String value) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(Name, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(Name, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttributeWithValue(String name, String uri, String value) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(name, uri, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(name, uri, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertAttributeWithValue(QName name, String value) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(name, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertAttributeWithValue(name, value);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertNamespace(String prefix, String namespace) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertNamespace(prefix, namespace);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertNamespace(prefix, namespace);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertComment(String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertComment(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertComment(text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void insertProcInst(String target, String text) {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _insertProcInst(target, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _insertProcInst(target, text);
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
+
+    public void dump() {
+        if (preCheck()) {
+            _cur._locale.enter();
+            try {
+                _dump();
+            } finally {
+                _cur._locale.exit();
+            }
+        } else synchronized (_cur._locale) {
+            _cur._locale.enter();
+            try {
+                _dump();
+            } finally {
+                _cur._locale.exit();
+            }
+        }
+    }
     
     //
     //
     //
 
-    private Cur        _cur;
+    private Cur _cur;
     private PathEngine _pathEngine;
-    private int        _currentSelection;
+    private int _currentSelection;
 
     private ChangeListener _nextChangeListener;
 } 

Modified: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java&r1=125212&p2=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java	(original)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java	Fri Jan 14 13:48:30 2005
@@ -1178,7 +1178,7 @@
             loadNode( c, context );
     }
 
-    private void loadNode ( Node n, LoadContext context )
+     void loadNode ( Node n, LoadContext context )
     {
         switch ( n.getNodeType() )
         {

Modified: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java&r1=125212&p2=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java	(original)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Path.java	Fri Jan 14 13:48:30 2005
@@ -15,25 +15,25 @@
 
 package org.apache.xmlbeans.impl.newstore2;
 
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
+import java.util.*;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
-
-import org.apache.xmlbeans.XmlRuntimeException;
+import java.math.BigDecimal;
 
 import org.apache.xmlbeans.impl.common.XPath;
 import org.apache.xmlbeans.impl.common.XPath.XPathCompileException;
 import org.apache.xmlbeans.impl.common.XPath.ExecutionContext;
 
-import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.*;
+import org.w3c.dom.Node;
+
 
 // TODO - This class handled query *and* path ... rename it?
 
 public abstract class Path
 {
-    Path ( String key )
+    Path(String key)
     {
         _pathKey = key;
     }
@@ -43,86 +43,80 @@
 
     interface PathEngine
     {
-        void release ( );
-        boolean next ( Cur c );
+        void release();
+
+        boolean next(Cur c);
     }
 
-    abstract PathEngine execute ( Cur c );
+    abstract PathEngine execute(Cur c);
 
     //
     //
     //
 
-    static String getCurrentNodeVar ( XmlOptions options )
+    static String getCurrentNodeVar(XmlOptions options)
     {
         String currentNodeVar = "this";
 
-        options = XmlOptions.maskNull( options );
-        
-        if (options.hasOption( XmlOptions.XQUERY_CURRENT_NODE_VAR ))
-        {
-            currentNodeVar = (String) options.get( XmlOptions.XQUERY_CURRENT_NODE_VAR );
+        options = XmlOptions.maskNull(options);
 
-            if (currentNodeVar.startsWith( "$" ))
-            {
+        if (options.hasOption(XmlOptions.XQUERY_CURRENT_NODE_VAR)) {
+            currentNodeVar = (String) options.get(XmlOptions.XQUERY_CURRENT_NODE_VAR);
+
+            if (currentNodeVar.startsWith("$")) {
                 throw
-                    new IllegalArgumentException(
-                        "Omit the '$' prefix for the current node variable" );
+                        new IllegalArgumentException("Omit the '$' prefix for the current node variable");
             }
         }
 
         return currentNodeVar;
     }
 
-    private static final int FORCE_XQRL    = 0;
-    private static final int FORCE_XBEAN   = 1;
+    private static final int FORCE_XQRL = 0;
+    private static final int FORCE_XBEAN = 1;
     private static final int FORCE_NEITHER = 2;
 
-    public static Path getCompiledPath ( String pathExpr, XmlOptions options )
+    public static Path getCompiledPath(String pathExpr, XmlOptions options)
     {
-        options = XmlOptions.maskNull( options );
+        options = XmlOptions.maskNull(options);
 
-        int force = 
-            options.hasOption( _useXqrlForXpath )
+        int force =
+                options.hasOption(_useXqrlForXpath)
                 ? FORCE_XQRL
-                : options.hasOption( _useXbeanForXpath )
-                   ? FORCE_XBEAN
-                   : FORCE_NEITHER;
+                : options.hasOption(_useXbeanForXpath)
+                ? FORCE_XBEAN
+                : FORCE_NEITHER;
 
-        return getCompiledPath( pathExpr, force, getCurrentNodeVar( options ) );
+        return getCompiledPath(pathExpr, force, getCurrentNodeVar(options));
     }
 
-    static synchronized Path getCompiledPath ( String pathExpr, int force, String currentVar )
+    static synchronized Path getCompiledPath(String pathExpr, int force, String currentVar)
     {
-        if (force == FORCE_XQRL)
-        {
-            Path path = (Path) _xqrlPathCache.get( pathExpr );
+        if (force == FORCE_XQRL) {
+            Path path = (Path) _xqrlPathCache.get(pathExpr);
 
-            if (path == null)
-            {
-                path = createXqrlCompiledPath( pathExpr, currentVar );
+            if (path == null) {
+                path = createXqrlCompiledPath(pathExpr, currentVar);
 
                 if (path == null)
-                    throw new RuntimeException( "Can't force XQRL: Can't find xqrl" );
+                    throw new RuntimeException("Can't force XQRL: Can't find xqrl");
 
-                _xqrlPathCache.put( path._pathKey, path );
+                _xqrlPathCache.put(path._pathKey, path);
             }
 
             return path;
         }
+        Map namespaces = new HashMap();
+        if (force == FORCE_XBEAN) {
+            Path path = (Path) _xbeanPathCache.get(pathExpr);
 
-        if (force == FORCE_XBEAN)
-        {
-            Path path = (Path) _xbeanPathCache.get( pathExpr );
-            
-            if (path == null)
-            {
-                path = XbeanPath.create( pathExpr, currentVar );
+            if (path == null) {
+                path = XbeanPath.create(pathExpr, currentVar, namespaces);
 
                 if (path == null)
-                    throw new XmlRuntimeException( "Path too complex for XBean path engine" );
+                    throw new XmlRuntimeException("Path too complex for XBean path engine");
 
-                _xbeanPathCache.put( path._pathKey, path );
+                _xbeanPathCache.put(path._pathKey, path);
             }
 
             return path;
@@ -130,36 +124,43 @@
 
         assert force == FORCE_NEITHER;
 
-        Path path = (Path) _xbeanPathCache.get( pathExpr );
+        Path path = (Path) _xbeanPathCache.get(pathExpr);
 
         if (path == null)
-            path = (Path) _xqrlPathCache.get( pathExpr );
+            path = (Path) _xqrlPathCache.get(pathExpr);
 
-        if (path == null)
-        {
-            path = XbeanPath.create( pathExpr, currentVar );
+        if (path == null) {
+            path = XbeanPath.create(pathExpr, currentVar, namespaces);
 
             if (path != null)
-                _xbeanPathCache.put( path._pathKey, path );
-            else
-            {
-                path = createXqrlCompiledPath( pathExpr, currentVar );
-
-                if (path == null)
-                    throw new RuntimeException( "Path too complex for xmlbeans" );
-
-                _xqrlPathCache.put( path._pathKey, path );
+                _xbeanPathCache.put(path._pathKey, path);
+            else {
+                path = createXqrlCompiledPath(pathExpr, currentVar);
+                if (path != null)
+                    _xqrlPathCache.put(path._pathKey, path);
+            }
+            //XQRL is not on the path either; this has to be XQRL
+            if (path == null) {
+                int offset =
+                        namespaces.get(XPath._NS_BOUNDARY) == null ?
+                        0 :
+                        ((Integer) namespaces.get(XPath._NS_BOUNDARY)).intValue();
+                namespaces.remove(XPath._NS_BOUNDARY);
+                path = SaxonPathImpl.create(pathExpr.substring(offset),
+                        currentVar,
+                        namespaces);
+                if (path != null)
+                    _xbeanPathCache.put(path._pathKey, path);
             }
         }
-
-        assert path != null;
-
+        if (path == null)
+            throw new RuntimeException("Path too complex for xmlbeans");
         return path;
-   }
-    
-    public static synchronized String compilePath ( String pathExpr, XmlOptions options )
+    }
+
+    public static synchronized String compilePath(String pathExpr, XmlOptions options)
     {
-        return getCompiledPath( pathExpr, options )._pathKey;
+        return getCompiledPath(pathExpr, options)._pathKey;
     }
 
     //
@@ -168,29 +169,27 @@
 
     private static final class XbeanPath extends Path
     {
-        static Path create ( String pathExpr, String currentVar )
+        static Path create(String pathExpr, String currentVar, Map namespaces)
         {
-            try
-            {
+            try {
                 return
-                    new XbeanPath(
-                        pathExpr, currentVar, XPath.compileXPath( pathExpr, currentVar ) );
+                        new XbeanPath(pathExpr, currentVar,
+                                XPath.compileXPath(pathExpr, currentVar, namespaces));
             }
-            catch ( XPathCompileException e )
-            {
+            catch (XPathCompileException e) {
                 return null;
             }
         }
-        
-        private XbeanPath ( String pathExpr, String currentVar, XPath xpath )
+
+        private XbeanPath(String pathExpr, String currentVar, XPath xpath)
         {
-            super( pathExpr );
+            super(pathExpr);
 
             _currentVar = currentVar;
             _compiledPath = xpath;
         }
-        
-        PathEngine execute ( Cur c )
+
+        PathEngine execute(Cur c)
         {
             // The builtin XPath engine works only on containers.  Delegate to
             // xqrl otherwise.  Also, if the path had a //. at the end, the
@@ -198,102 +197,93 @@
             // attrs and elements.
 
             if (!c.isContainer() || _compiledPath.sawDeepDot())
-                return getCompiledPath( _pathKey, FORCE_XQRL, _currentVar ).execute( c );
+                return getCompiledPath(_pathKey, FORCE_XQRL, _currentVar).execute(c);
 
-            return new XbeanPathEngine( _compiledPath, c );
+            return new XbeanPathEngine(_compiledPath, c);
         }
 
         private final String _currentVar;
-        private final XPath  _compiledPath;
+        private final XPath _compiledPath;
+        //return a map of namespaces for Saxon, if it's ever invoked
+        public Map namespaces;
     }
 
-    private static Path createXqrlCompiledPath ( String pathExpr, String currentVar )
+    private static Path createXqrlCompiledPath(String pathExpr, String currentVar)
     {
-        if (_xqrlCompilePath == null)
-        {
-            try
-            {
-                Class xqrlImpl = Class.forName( "org.apache.xmlbeans.impl.newstore2.XqrlImpl" );
+        if (_xqrlCompilePath == null) {
+            try {
+                Class xqrlImpl = Class.forName("org.apache.xmlbeans.impl.newstore2.XqrlImpl");
 
                 _xqrlCompilePath =
-                    xqrlImpl.getDeclaredMethod(
-                        "compilePath", new Class[] { String.class, String.class, Boolean.class } );
+                        xqrlImpl.getDeclaredMethod("compilePath",
+                                new Class[]{String.class, String.class, Boolean.class});
             }
-            catch ( ClassNotFoundException e )
-            {
+            catch (ClassNotFoundException e) {
                 return null;
             }
-            catch ( Exception e )
-            {
-                throw new RuntimeException( e.getMessage(), e );
+            catch (Exception e) {
+                throw new RuntimeException(e.getMessage(), e);
             }
         }
 
-        Object[] args = new Object[] { pathExpr, currentVar, new Boolean( true ) };
+        Object[] args = new Object[]{pathExpr, currentVar, new Boolean(true)};
 
-        try
-        {
-            return (Path) _xqrlCompilePath.invoke( null, args );
+        try {
+            return (Path) _xqrlCompilePath.invoke(null, args);
         }
-        catch ( InvocationTargetException e )
-        {
-            throw new RuntimeException( e.getMessage(), e );
+        catch (InvocationTargetException e) {
+            throw new RuntimeException(e.getMessage(), e);
         }
-        catch ( IllegalAccessException e )
-        {
-            throw new RuntimeException( e.getMessage(), e );
+        catch (IllegalAccessException e) {
+            throw new RuntimeException(e.getMessage(), e);
         }
     }
 
     private static final class XbeanPathEngine extends ExecutionContext implements PathEngine
     {
-        XbeanPathEngine ( XPath xpath, Cur c )
+        XbeanPathEngine(XPath xpath, Cur c)
         {
             assert c.isContainer();
-            
+
             _version = c._locale.version();
-            _cur = c.weakCur( this );
+            _cur = c.weakCur(this);
 
             _cur.push();
-            
-            init( xpath );
+
+            init(xpath);
 
             int ret = start();
 
             if ((ret & HIT) != 0)
                 c.addToSelection();
 
-            doAttrs( ret, c );
+            doAttrs(ret, c);
 
-            if ((ret & DESCEND) == 0 || !Locale.toFirstChildElement( _cur ))
+            if ((ret & DESCEND) == 0 || !Locale.toFirstChildElement(_cur))
                 release();
         }
 
-        private void advance ( Cur c )
+        private void advance(Cur c)
         {
             assert _cur != null;
 
-            if (_cur.isFinish())
-            {
+            if (_cur.isFinish()) {
                 if (_cur.isAtEndOfLastPush())
                     release();
-                else
-                {
+                else {
                     end();
                     _cur.next();
                 }
             }
-            else if (_cur.isElem())
-            {
-                int ret = element( _cur.getName() );
-                
+            else if (_cur.isElem()) {
+                int ret = element(_cur.getName());
+
                 if ((ret & HIT) != 0)
-                    c.addToSelection( _cur );
+                    c.addToSelection(_cur);
 
-                doAttrs( ret, c );
+                doAttrs(ret, c);
 
-                if ((ret & DESCEND) == 0 || !Locale.toFirstChildElement( _cur ))
-                {
+                if ((ret & DESCEND) == 0 || !Locale.toFirstChildElement(_cur)) {
                     end();
                     _cur.skip();
                 }
@@ -301,37 +291,33 @@
             else
                 _cur.next();
         }
-        
-        private void doAttrs ( int ret, Cur c )
+
+        private void doAttrs(int ret, Cur c)
         {
             assert _cur.isContainer();
-            
-            if ((ret & ATTRS) != 0)
-            {
-                if (_cur.toFirstAttr())
-                {
-                    do
-                    {
-                        if (attr( _cur.getName() ))
-                            c.addToSelection( _cur );
+
+            if ((ret & ATTRS) != 0) {
+                if (_cur.toFirstAttr()) {
+                    do {
+                        if (attr(_cur.getName()))
+                            c.addToSelection(_cur);
                     }
-                    while ( _cur.toNextAttr() );
+                    while (_cur.toNextAttr());
 
                     _cur.toParent();
                 }
             }
         }
 
-        public boolean next ( Cur c )
+        public boolean next(Cur c)
         {
             if (_cur != null && _version != _cur._locale.version())
-                throw new ConcurrentModificationException( "Document changed during select" );
-            
+                throw new ConcurrentModificationException("Document changed during select");
+
             int startCount = c.selectionCount();
 
-            while ( _cur != null )
-            {
-                advance( c );
+            while (_cur != null) {
+                advance(c);
 
                 if (startCount != c.selectionCount())
                     return true;
@@ -340,27 +326,164 @@
             return false;
         }
 
-        public void release( )
+        public void release()
         {
-            if (_cur != null)
-            {
+            if (_cur != null) {
                 _cur.release();
                 _cur = null;
             }
         }
-        
+
         private final long _version;
-        private       Cur  _cur;
+        private Cur _cur;
     }
 
-    //
-    //
-    //
-    
+    private static final class SaxonPathImpl extends Path
+    {
+
+        private SaxonXBeansDelegate.SelectPathInterface _xpathImpl;
+
+
+        static Path create(String pathExpr, String currentNodeVar, Map namespaceMap)
+        {
+            assert !currentNodeVar.startsWith("$"); // cezar review with ericvas
+
+            SaxonXBeansDelegate.SelectPathInterface impl =
+                    SaxonXBeansDelegate.createInstance(pathExpr, namespaceMap);
+            if (impl == null)
+                return null;
+
+            return new SaxonPathImpl(impl, pathExpr);
+        }
+
+
+        private SaxonPathImpl(SaxonXBeansDelegate.SelectPathInterface xpathImpl,
+                              String pathExpr)
+        {
+            super(pathExpr);
+            _xpathImpl = xpathImpl;
+        }
+
+        protected PathEngine execute(Cur c)
+        {
+            return new SaxonPathEngine(_xpathImpl, c);
+        }
+
+        private static class SaxonPathEngine
+                extends XPath.ExecutionContext
+                implements PathEngine
+        {
+
+            SaxonPathEngine(SaxonXBeansDelegate.SelectPathInterface xpathImpl,
+                            Cur c)
+            {
+                _saxonXpathImpl = xpathImpl;
+                _version = c._locale.version();
+                _cur = c.weakCur(this);
+            }
+
+            public boolean next(Cur c)
+            {
+                if (!_firstCall)
+                    return false;
+
+                _firstCall = false;
+
+                if (_cur != null && _version != _cur._locale.version())
+                    throw new ConcurrentModificationException("Document changed during select");
+
+                List resultsList;
+                Object context_node;
+
+                context_node = _cur.getDom();
+                resultsList = _saxonXpathImpl.selectPath(context_node);
+
+                int i;
+                for (i = 0; i < resultsList.size(); i++) {
+                    //simple type function results
+                    Object node = resultsList.get(i);
+                    Cur pos = null;
+                    if (!(node instanceof Node)) {
+                        String value;
+
+                        value = resultsList.get(i).toString();
+
+                        //we cannot leave the cursor's locale, as
+                        //everything is done in the selections of this cursor
+
+                        Locale l = c._locale;
+                        try {
+                            pos = l.load("<xml-fragment>" +
+                                    value +
+                                    "</xml-fragment>").tempCur();
+                            SchemaType type = getType(node);
+                            Locale.autoTypeDocument(pos, type, null);
+                            //move the cur to the actual text
+                            pos.next();
+                        }
+                        catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                    }
+                    else {
+                        assert (node instanceof DomImpl.Dom):
+                                "New object created in XPATH!";
+                        pos = ((DomImpl.Dom) node).tempCur();
+
+                    }
+                    c.addToSelection(pos);
+                    pos.release();
+                }
+                release();
+                _saxonXpathImpl = null;
+                return true;
+            }
+
+            private SchemaType getType(Object node)
+            {
+                SchemaType type;
+                if (node instanceof Integer)
+                    type = XmlInteger.type;
+                else if (node instanceof Double)
+                    type = XmlDouble.type;
+                else if (node instanceof Long)
+                    type = XmlLong.type;
+                else if (node instanceof Float)
+                    type = XmlFloat.type;
+                else if (node instanceof BigDecimal)
+                    type = XmlDecimal.type;
+                else if (node instanceof Boolean)
+                    type = XmlBoolean.type;
+                else if (node instanceof String)
+                    type = XmlString.type;
+                else if (node instanceof Date)
+                    type = XmlDate.type;
+                else
+                    type = XmlAnySimpleType.type;
+                return type;
+            }
+
+            public void release()
+            {
+                if (_cur != null) {
+                    _cur.release();
+                    _cur = null;
+                }
+            }
+
+            private Cur _cur;
+            private SaxonXBeansDelegate.SelectPathInterface _saxonXpathImpl;
+            private boolean _firstCall = true;
+            private long _version;
+        }
+
+    }
+
+
     protected final String _pathKey;
-    
+
     private static HashMap _xbeanPathCache = new HashMap();
-    private static HashMap _xqrlPathCache  = new HashMap();
-    
+    private static HashMap _xqrlPathCache = new HashMap();
+
     private static Method _xqrlCompilePath;
-} 
\ No newline at end of file
+}
\ No newline at end of file

Modified: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java&r1=125212&p2=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java	(original)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Query.java	Fri Jan 14 13:48:30 2005
@@ -15,101 +15,337 @@
 
 package org.apache.xmlbeans.impl.newstore2;
 
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.common.XPath;
+import org.w3c.dom.*;
 
+import javax.xml.namespace.QName;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Date;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
 
 public abstract class Query
 {
-    abstract XmlObject[] execute ( Cur c, XmlOptions options );
+    abstract XmlObject[] objectExecute(Cur c, XmlOptions options);
+
+    abstract XmlCursor cursorExecute(Cur c, XmlOptions options);
 
     //
     // Xqrl store specific implementation of compiled path/query
     //
 
-    static XmlObject[] execQuery ( Cur c, String queryExpr, XmlOptions options )
+    static XmlObject[] objectExecQuery(Cur c, String queryExpr, XmlOptions options)
     {
-        return getCompiledQuery( queryExpr, options ).execute( c, options );
+        return getCompiledQuery(queryExpr, options).objectExecute(c, options);
     }
 
-    public static synchronized Query getCompiledQuery ( String queryExpr, XmlOptions options )
+    static XmlCursor cursorExecQuery(Cur c, String queryExpr, XmlOptions options)
     {
-        return getCompiledQuery( queryExpr, Path.getCurrentNodeVar( options ) );
+        return getCompiledQuery(queryExpr, options).cursorExecute(c, options);
     }
-    
-    static synchronized Query getCompiledQuery ( String queryExpr, String currentVar )
-    {
-        assert queryExpr != null;
-        
-        Query query = (Query) _xqrlQueryCache.get( queryExpr );
 
-        if (query != null)
-            return query;
+    public static synchronized Query getCompiledQuery(String queryExpr, XmlOptions options)
+    {
+        return getCompiledQuery(queryExpr, Path.getCurrentNodeVar(options));
+    }
 
-        // TODO - may want to add other query engines here: xqrl v2, saxon?
-        
-        query = createXqrlCompiledQuery( queryExpr, currentVar );
+    static synchronized Query getCompiledQuery(String queryExpr, String currentVar)
+    {
+        assert queryExpr != null;
 
-        if (query == null)
-            throw new RuntimeException( "No query engine found" );
+        //Parse the query via XBeans: need to figure out end of prolog
+        //in order to bind $this...not good but...
+        Map boundary = new HashMap();
+        int boundaryVal = 0;
+        try {
+            XPath.compileXPath(queryExpr, currentVar, boundary);
+        }
+        catch (XPath.XPathCompileException e) {
+            //don't care if it fails, just care about boundary
+        }
+        finally {
+            boundaryVal = boundary.get(XPath._NS_BOUNDARY) == null ?
+                    0 :
+                    ((Integer) boundary.get(XPath._NS_BOUNDARY)).intValue();
 
-        _xqrlQueryCache.put( queryExpr, query );
+        }
 
-        return query;
-    }
+        //try XQRL
+        Query query = (Query) _xqrlQueryCache.get(queryExpr);
+        if (query != null)
+            return query;
+        else {
+            query = createXqrlCompiledQuery(queryExpr, currentVar);
+            if (query != null)
+                _xqrlQueryCache.put(queryExpr, query);
+            else {
+                //query is still null; look for Saxon
+                query = (Query) _saxonQueryCache.get(queryExpr);
+                if (query != null)
+                    return query;
+                else
+                    query = SaxonQueryImpl.createSaxonCompiledQuery(queryExpr, currentVar, boundaryVal);
+                if (query != null)
+                    _saxonQueryCache.put(queryExpr, query);
+            }
+        }
+            if (query == null)
+                throw new RuntimeException("No query engine found");
+            return query;
+        }
 
-    public static synchronized String compileQuery ( String queryExpr, XmlOptions options )
+    public static synchronized String compileQuery(String queryExpr, XmlOptions options)
     {
-        getCompiledQuery( queryExpr, options );
+        getCompiledQuery(queryExpr, options);
         return queryExpr;
     }
 
-    private static Query createXqrlCompiledQuery ( String queryExpr, String currentVar )
+    private static Query createXqrlCompiledQuery(String queryExpr, String currentVar)
     {
-        if (_xqrlCompileQuery == null)
-        {
-            try
-            {
-                Class xqrlImpl = Class.forName( "org.apache.xmlbeans.impl.newstore2.XqrlImpl" );
+        if (_xqrlCompileQuery == null) {
+            try {
+                Class xqrlImpl = Class.forName("org.apache.xmlbeans.impl.newstore2.XqrlImpl");
 
                 _xqrlCompileQuery =
-                    xqrlImpl.getDeclaredMethod(
-                        "compileQuery", new Class[] { String.class, String.class, Boolean.class } );
+                        xqrlImpl.getDeclaredMethod("compileQuery",
+                                new Class[]{String.class, String.class, Boolean.class});
             }
-            catch ( ClassNotFoundException e )
-            {
+            catch (ClassNotFoundException e) {
                 return null;
             }
-            catch ( Exception e )
-            {
-                throw new RuntimeException( e.getMessage(), e );
+            catch (Exception e) {
+                throw new RuntimeException(e.getMessage(), e);
             }
         }
 
-        Object[] args = new Object[] { queryExpr, currentVar, new Boolean( true ) };
+        Object[] args = new Object[]{queryExpr, currentVar, new Boolean(true)};
+
+        try {
+            return (Query) _xqrlCompileQuery.invoke(null, args);
+        }
+        catch (InvocationTargetException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+        catch (IllegalAccessException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+
+    private static final class SaxonQueryImpl extends Query
+    {
+
+        private SaxonQueryImpl(SaxonXBeansDelegate.QueryInterface xqueryImpl)
+        {
+            _xqueryImpl = xqueryImpl;
+        }
+
+        public static Query createSaxonCompiledQuery(String queryExpr,
+                                                     String currentVar,
+                                                     int boundary)
+        {
+            assert !(currentVar.startsWith(".") || currentVar.startsWith(".."));
+
+            SaxonXBeansDelegate.QueryInterface impl =
+                    SaxonXBeansDelegate.createQueryInstance(queryExpr,
+                            currentVar, boundary);
+            if (impl == null)
+                return null;
+
+            return new SaxonQueryImpl(impl);
+        }
 
-        try
+        XmlObject[] objectExecute(Cur c, XmlOptions options)
         {
-            return (Query) _xqrlCompileQuery.invoke( null, args );
+            return new SaxonQueryEngine(_xqueryImpl, c, options).objectExecute();
         }
-        catch ( InvocationTargetException e )
+
+        XmlCursor cursorExecute(Cur c, XmlOptions options)
         {
-            throw new RuntimeException( e.getMessage(), e );
+            return new SaxonQueryEngine(_xqueryImpl, c, options).cursorExecute();
         }
-        catch ( IllegalAccessException e )
+
+
+        private static class SaxonQueryEngine
         {
-            throw new RuntimeException( e.getMessage(), e );
+            public SaxonQueryEngine(SaxonXBeansDelegate.QueryInterface xqImpl,
+                                    Cur c, XmlOptions opt)
+            {
+
+                _saxonImpl = xqImpl;
+                _version = c._locale.version();
+                _cur = c.weakCur(this);
+                _options = opt;
+
+            }
+
+            public XmlObject[] objectExecute()
+            {
+                if (_cur != null && _version != _cur._locale.version())
+                //throw new ConcurrentModificationException
+                // ("Document changed during select")
+                    ;
+
+                List resultsList;
+                resultsList = _saxonImpl.execQuery(_cur.getDom());
+
+                assert resultsList.size() > -1;
+
+                XmlObject[] result = new XmlObject[resultsList.size()];
+                int i;
+                for (i = 0; i < resultsList.size(); i++) {
+                    //copy objects into the locale
+                    Locale l = Locale.getLocale(_cur._locale._schemaTypeLoader,
+                            _options);
+
+                    l.enter();
+                    Object node = resultsList.get(i);
+                    Cur res = null;
+                    try {
+                        //typed function results of XQuery
+                        if (!(node instanceof Node)) {
+                            //TODO: exact same code as Path.java
+                            //make a common super-class and pull this--what to name that
+                            //superclass???
+                            res = l.load("<xml-fragment>" +
+                                    node.toString() +
+                                    "</xml-fragment>").tempCur();
+                            SchemaType type=getType(node);
+                            Locale.autoTypeDocument(res, type, null);
+                            result[i] = res.getObject();
+                        }
+                        else
+                            res = loadNode(l, (Node) node);
+                        result[i] = res.getObject();
+                    }
+                    catch (XmlException e) {
+                        throw new RuntimeException(e);
+                    }
+                    finally {
+                        l.exit();
+                    }
+                    res.release();
+                }
+                release();
+                _saxonImpl = null;
+                return result;
+            }
+            private SchemaType getType(Object node)
+            {
+                SchemaType type;
+                if (node instanceof Integer)
+                    type = XmlInteger.type;
+                else if (node instanceof Double)
+                    type = XmlDouble.type;
+                else if (node instanceof Long)
+                    type = XmlLong.type;
+                else if (node instanceof Float)
+                    type = XmlFloat.type;
+                else if (node instanceof BigDecimal)
+                    type = XmlDecimal.type;
+                else if (node instanceof Boolean)
+                    type = XmlBoolean.type;
+                else if (node instanceof String)
+                    type = XmlString.type;
+                else if (node instanceof Date)
+                    type = XmlDate.type;
+                else
+                    type = XmlAnySimpleType.type;
+                return type;
+            }
+            public XmlCursor cursorExecute()
+            {
+                if (_cur != null && _version != _cur._locale.version())
+                //throw new ConcurrentModificationException
+                // ("Document changed during select")
+                    ;
+
+                List resultsList;
+                resultsList = _saxonImpl.execQuery(_cur.getDom());
+
+                assert resultsList.size() > -1;
+
+                int i;
+                _saxonImpl = null;
+
+                Locale locale = Locale.getLocale(_cur._locale._schemaTypeLoader, _options);
+                locale.enter();
+                Locale.LoadContext _context = new Cur.CurLoadContext(locale, _options);
+                Cursor resultCur = null;
+                try {
+                    for (i = 0; i < resultsList.size(); i++) {
+                        loadNodeHelper(locale, (Node) resultsList.get(i), _context);
+                    }
+                    Cur c = _context.finish();
+                    Locale.associateSourceName(c, _options);
+                    Locale.autoTypeDocument(c, null, _options);
+                    resultCur = new Cursor(c);
+                }
+                catch (Exception e) {
+                }
+                finally {
+                    locale.exit();
+                }
+                release();
+                return resultCur;
+            }
+
+
+            public void release()
+            {
+                if (_cur != null) {
+                    _cur.release();
+                    _cur = null;
+                }
+            }
+
+
+            private Cur loadNode(Locale locale, Node node)
+            {
+                Locale.LoadContext context = new Cur.CurLoadContext(locale, _options);
+
+                try {
+                    loadNodeHelper(locale, node, context);
+                    Cur c = context.finish();
+                    Locale.associateSourceName(c, _options);
+                    Locale.autoTypeDocument(c, null, _options);
+                    return c;
+                }
+                catch (Exception e) {
+                    throw new XmlRuntimeException(e.getMessage(), e);
+                }
+            }
+
+            private void loadNodeHelper(Locale locale, Node node, Locale.LoadContext context)
+            {
+                if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                    QName attName = new QName(node.getNamespaceURI(),
+                            node.getLocalName(),
+                            node.getPrefix());
+                    context.attr(attName, node.getNodeValue());
+                }
+                else
+                    locale.loadNode(node, context);
+
+            }
+
+
+            private Cur _cur;
+            private SaxonXBeansDelegate.QueryInterface _saxonImpl;
+            private long _version;
+            private XmlOptions _options;
         }
+
+        private SaxonXBeansDelegate.QueryInterface _xqueryImpl;
     }
 
-    //
-    //
-    //
 
     private static HashMap _xqrlQueryCache = new HashMap();
-    
+    private static HashMap _saxonQueryCache = new HashMap();
+
     private static Method _xqrlCompileQuery;
 }

Added: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/SaxonXBeansDelegate.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/SaxonXBeansDelegate.java?view=auto&rev=125213
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/SaxonXBeansDelegate.java	Fri Jan 14 13:48:30 2005
@@ -0,0 +1,131 @@
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.newstore2;
+
+import org.apache.xmlbeans.impl.common.XPath;
+
+import java.util.List;
+import java.util.Map;
+import java.lang.reflect.Constructor;
+
+
+/**
+ * Date: Dec 6,2004
+ *
+ * Help class to decouple from xbean_xpath.jar and saxon.jar (version Saxon-B 8.1.1)
+ */
+public final class SaxonXBeansDelegate
+{
+    static
+        {
+            boolean hasTheJars = false;
+            Class saxonXPathImpl = null;
+            Class saxonXQueryImpl = null;
+            try
+            {
+                // from xbean_xpath.jar
+                saxonXPathImpl = Class
+                        .forName( "org.apache.xmlbeans.impl.xpath.saxon.XBeansXPath" );
+                saxonXQueryImpl = Class
+                        .forName( "org.apache.xmlbeans.impl.xquery.saxon.XBeansXQuery" );
+
+
+                hasTheJars = true;
+            }
+            catch ( ClassNotFoundException e )
+            {
+                hasTheJars = false;
+            }
+            catch ( NoClassDefFoundError e )
+            {
+                hasTheJars = false;
+            }
+
+            if (hasTheJars)
+            {
+                try
+                {
+                    _constructor =
+                        saxonXPathImpl.getConstructor( new Class[] { String.class,
+                                                                     Map.class,
+                                                                     String.class} );
+                    _xqConstructor =
+                            saxonXQueryImpl.getConstructor( new Class[] { String.class,
+                                                                          String.class,
+                                                                          Integer.class} );
+
+                }
+                catch ( Exception e )
+                {
+                    throw new RuntimeException( e );
+                }
+            }
+        }
+
+    private SaxonXBeansDelegate()
+    {}
+
+    static SelectPathInterface createInstance(String xpath, Map namespaceMap)
+    {
+           if (_constructor == null)
+            return null;
+
+        try
+        {
+            Object defaultNS = namespaceMap.get(XPath._DEFAULT_ELT_NS);
+            if ( defaultNS != null )
+                namespaceMap.remove( XPath._DEFAULT_ELT_NS );
+            return (SaxonXBeansDelegate.SelectPathInterface)
+                    _constructor.newInstance(new Object[] {xpath,namespaceMap,(String)defaultNS});
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+   static QueryInterface createQueryInstance(String query, String contextVar, int boundary)
+    {
+           if (_xqConstructor == null)
+            return null;
+
+        try
+        {
+            return (SaxonXBeansDelegate.QueryInterface)
+                    _xqConstructor.newInstance(new Object[] {query,contextVar,new Integer(boundary)});
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+
+    public static interface SelectPathInterface
+    {
+        public List selectPath(Object node);
+    }
+
+     public static interface QueryInterface
+    {
+        public List execQuery(Object node);
+    }
+
+     private static Constructor _constructor;
+     private static Constructor _xqConstructor;
+
+}
\ No newline at end of file

Modified: xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java&r1=125212&p2=xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java	(original)
+++ xmlbeans/trunk/src/newstore2/org/apache/xmlbeans/impl/newstore2/Xobj.java	Fri Jan 14 13:48:30 2005
@@ -2297,7 +2297,7 @@
         {
             Cur c = tempCur();
             
-            XmlObject[] result = Query.execQuery( c, queryExpr, options );
+            XmlObject[] result = Query.objectExecQuery( c, queryExpr, options );
             
             c.release();
 

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java?view=diff&rev=125213&p1=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java&r1=125212&p2=xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java&r2=125213
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java	(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java	Fri Jan 14 13:48:30 2005
@@ -436,6 +436,7 @@
                 {
                     if ((selections[ i ] = c.getObject()) == null)
                     {
+                        if ( !c.toParent() || (selections[ i ] = c.getObject()) == null )
                         throw
                             new XmlRuntimeException(
                                 "Path must select only elements " +

Added: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansStandaloneContext.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansStandaloneContext.java?view=auto&rev=125213
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansStandaloneContext.java	Fri Jan 14 13:48:30 2005
@@ -0,0 +1,46 @@
+package org.apache.xmlbeans.impl.xpath.saxon;
+
+import net.sf.saxon.xpath.StandaloneContext;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.om.NamespaceConstant;
+import net.sf.saxon.om.NamePool;
+
+/**
+ * Date: Jan 10, 2005
+ * Time: 10:46:59 AM
+ * <p/>
+ * This class is used to circumvent a Saxon limitation,
+ * namely, the lack of a method to set the default element NS
+ */
+public class XBeansStandaloneContext extends StandaloneContext
+{
+    public XBeansStandaloneContext(Configuration c)
+    {
+        super(c);
+    }
+
+    public XBeansStandaloneContext()
+    {
+        super();
+    }
+
+    public void setDefaultElementNamespace(String uri)
+    {
+        defaultUri = true;
+        defaultNSCode = this.getNamePool().allocateCodeForURI(uri);
+    }
+
+    public short getDefaultElementNamespace()
+    {
+        short result = super.getDefaultElementNamespace();
+        if (result == NamespaceConstant.NULL_CODE
+                && defaultUri)
+            return (short) defaultNSCode;
+
+        else
+            return result;
+    }
+
+    private int defaultNSCode;
+    private boolean defaultUri;
+}

Added: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java?view=auto&rev=125213
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java	Fri Jan 14 13:48:30 2005
@@ -0,0 +1,107 @@
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.xpath.saxon;
+
+import org.apache.xmlbeans.impl.newstore2.SaxonXBeansDelegate;
+import org.w3c.dom.Node;
+
+import java.util.List;
+import java.util.Map;
+
+import net.sf.saxon.query.*;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.xpath.XPathException;
+import net.sf.saxon.xpath.XPathEvaluator;
+import net.sf.saxon.xpath.StandaloneContext;
+
+import javax.xml.transform.dom.DOMSource;
+
+
+public class XBeansXPath
+        implements SaxonXBeansDelegate.SelectPathInterface {
+
+    /**
+     * Construct given an XPath expression string.
+     * @param xpathExpr The XPath expression.
+     * @param namespaceMap a map of prefix/uri bindings for NS support
+     * @param defaultNS the uri for the default element NS, if any
+     */
+    public XBeansXPath(String xpathExpr, Map namespaceMap, String defaultNS)
+    {
+        _queryExp = xpathExpr;
+        this.defaultNS = defaultNS;
+        this.namespaceMap = namespaceMap.entrySet().toArray();
+    }
+
+    /**
+     * Select all nodes that are selectable by this XPath
+     * expression. If multiple nodes match, multiple nodes
+     * will be returned.
+     * <p/>
+     * <p/>
+     * <b>NOTE:</b> In most cases, nodes will be returned
+     * in document-order, as defined by the XML Canonicalization
+     * specification.  The exception occurs when using XPath
+     * expressions involving the <code>union</code> operator
+     * (denoted with the pipe '|' character).
+     * </p>
+     * <p/>
+     * <p/>
+     * <b>NOTE:</b> Param node must be a Dom node which will be used during the xpath
+     * execution and iteration through the results. A call of node.dispose() must be done
+     * after reading all results.
+     * </p>
+     *
+     * @param node The node, nodeset or Context object for evaluation.
+     * This value can be null.
+     * @return The <code>a list</code> of all items selected
+     *         by this XPath expression.
+     */
+    public List selectNodes(Object node)
+    {
+        try
+        {
+            XPathEvaluator xpe = new XPathEvaluator(new DOMSource((Node) node));
+            XBeansStandaloneContext sc = new XBeansStandaloneContext();
+            xpe.setStaticContext(sc);
+
+            // Declare ns bindings
+            if (defaultNS != null)
+                sc.setDefaultElementNamespace(defaultNS);
+
+            for (int i = 0; i < namespaceMap.length; i++)
+            {
+                Map.Entry entry = (Map.Entry) namespaceMap[i];
+                sc.declareNamespace((String) entry.getKey(),
+                        (String) entry.getValue());
+            }
+              return xpe.evaluate(_queryExp);
+        }
+        catch (XPathException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public List selectPath(Object node)
+    {
+        return selectNodes(node);
+    }
+
+   private Object[] namespaceMap;
+    private String _queryExp;
+   private String defaultNS;
+}

Added: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java?view=auto&rev=125213
==============================================================================
--- (empty file)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java	Fri Jan 14 13:48:30 2005
@@ -0,0 +1,92 @@
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.xquery.saxon;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.query.DynamicQueryContext;
+import net.sf.saxon.query.StaticQueryContext;
+import net.sf.saxon.query.XQueryExpression;
+import net.sf.saxon.xpath.StaticError;
+import net.sf.saxon.xpath.XPathException;
+import org.apache.xmlbeans.XmlRuntimeException;
+import org.apache.xmlbeans.impl.newstore2.SaxonXBeansDelegate;
+import org.w3c.dom.Node;
+
+import javax.xml.transform.dom.DOMSource;
+import java.util.List;
+
+
+public class XBeansXQuery
+        implements SaxonXBeansDelegate.QueryInterface
+{
+
+    /**
+     * Construct given an XQuery expression string.
+     * @param queryExpr The XQuery expression.
+     * @param contextVar The name of the context variable
+     * @param boundary The offset of the end of the prolog
+     */
+    public XBeansXQuery(String queryExpr, String contextVar, Integer boundary)
+    {
+        this.config = new Configuration();
+        this._stcContext = new StaticQueryContext(config);
+        this._query = queryExpr;
+        this._contextVar = contextVar;
+        this.boundary = boundary.intValue();
+        //Saxon requires external variables at the end of the prolog...
+        String queryExp =
+                (this.boundary == 0) ?
+                "declare variable $" +
+                _contextVar + " external;" + _query :
+                _query.substring(0, this.boundary) +
+                "declare variable $" +
+                _contextVar + " external;" +
+                _query.substring(this.boundary + 1);
+        try {
+            this._xquery = _stcContext.compileQuery(queryExp);
+        }
+        catch (XPathException e) {
+            throw new XmlRuntimeException(e);
+        }
+    }
+
+    public List execQuery(Object node)
+    {
+        try {
+            Node context_node = (Node) node;
+            DynamicQueryContext dynamicContext =
+                    new DynamicQueryContext(config);
+            dynamicContext.setContextNode(_stcContext.
+                    buildDocument(new DOMSource(context_node)));
+            dynamicContext.setParameter(_contextVar,
+                    dynamicContext.getContextNode());
+            return _xquery.evaluate(dynamicContext);
+        }
+        catch (StaticError e) {
+            throw new RuntimeException(" Error binding " + _contextVar);
+        }
+        catch (XPathException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private XQueryExpression _xquery;
+    private String _query;
+    private String _contextVar;
+    private StaticQueryContext _stcContext;
+    private Configuration config;
+    private int boundary;
+}

Modified: xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd?view=diff&rev=125213&p1=xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd&r1=125212&p2=xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd&r2=125213
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd	(original)
+++ xmlbeans/trunk/test/cases/xbean/scomp/derivation/facets/FacetRestriction.xsd	Fri Jan 14 13:48:30 2005
@@ -35,12 +35,13 @@
         </xs:restriction>
     </xs:simpleType>
 
-
+<!-- Compile time test: this needs to fail
     <xs:simpleType name="LengthT">
            <xs:restriction base="base:LengthT">
                <xs:length value="1"/>
            </xs:restriction>
        </xs:simpleType>
+-->
 
     <xs:simpleType name="MinMaxLengthT">
            <xs:restriction base="base:MinMaxLengthT">
@@ -78,7 +79,7 @@
      <xs:element name="MinMaxInclusiveDateElt" type="MinMaxInclusiveDateT"/>
     <xs:element name="MinMaxExclusiveElt" type="MinMaxExclusiveT"/>
     <xs:element name="MinMaxExclusiveDateElt" type="MinMaxExclusiveDateT"/>
-    <xs:element name="LengthElt" type="LengthT"/>
+    <xs:element name="LengthElt" type="xs:integer"/>
     <xs:element name="MinMaxLengthElt" type="MinMaxLengthT"/>
     <xs:element name="DigitsElt" type="DigitsT"/>
     <xs:element name="WSElt" type="WST"/>

Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java&r1=125212&p2=xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java	(original)
+++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetRestrictionTest.java	Fri Jan 14 13:48:30 2005
@@ -112,7 +112,7 @@
 
 
     }
-
+     /*
       public void testLengthElt() throws Throwable {
         LengthEltDocument doc = LengthEltDocument.Factory.newInstance();
         doc.setLengthElt("foobar");
@@ -135,7 +135,7 @@
             throw t;
         }
     }
-
+     */
     public void testMinMaxLengthElt() throws Throwable {
           MinMaxLengthEltDocument doc = MinMaxLengthEltDocument.Factory.newInstance();
           String[] errExpected = new String[]{

Modified: xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java&r1=125212&p2=xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java	(original)
+++ xmlbeans/trunk/test/src/scomp/derivation/restriction/facets/detailed/FacetsTest.java	Fri Jan 14 13:48:30 2005
@@ -24,6 +24,7 @@
 import java.util.TimeZone;
 
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlOptions;
 
 /**
  * Date: Oct 25, 2004
@@ -82,23 +83,24 @@
 
     }
 
+    //valid range should be 3-9
     public void testMinMaxExclusiveElt() throws Throwable {
         MinMaxExclusiveEltDocument doc =
                 MinMaxExclusiveEltDocument.Factory.newInstance();
         String[] errExpected = new String[]{
-            XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH};
+            XmlErrorCodes.DATATYPE_MIN_EXCLUSIVE_VALID};
 
-        doc.setMinMaxExclusiveElt(3);
+        doc.setMinMaxExclusiveElt(2);
         assertTrue(!doc.validate(validateOptions));
         assertTrue(compareErrorCodes(errExpected));
-        doc.setMinMaxExclusiveElt(1);
+        doc.setMinMaxExclusiveElt(3);
         try {
             assertTrue(doc.validate(validateOptions));
         } catch (Throwable t) {
             showErrors();
             throw t;
         }
-        doc.setMinMaxExclusiveElt(11);
+        doc.setMinMaxExclusiveElt(9);
         try {
             assertTrue(doc.validate(validateOptions));
         } catch (Throwable t) {
@@ -108,16 +110,17 @@
 
     }
 
+    //valid range is 12-11 12-24-2003
     public void testMinMaxExclusiveDateElt() throws Throwable {
         MinMaxExclusiveDateEltDocument doc = MinMaxExclusiveDateEltDocument.Factory.newInstance();
-        Calendar c = new GregorianCalendar(2003, 11, 24);
+        Calendar c = new GregorianCalendar(2003, 11, 25);
         doc.setMinMaxExclusiveDateElt(c);
         String[] errExpected = new String[]{
             XmlErrorCodes.DATATYPE_MAX_EXCLUSIVE_VALID};
         assertTrue(!doc.validate(validateOptions));
         assertTrue(compareErrorCodes(errExpected));
 
-        c = new GregorianCalendar(2003, 11, 28);
+        c = new GregorianCalendar(2003, 11, 11);
         doc.setMinMaxExclusiveDateElt(c);
         try {
             assertTrue(doc.validate(validateOptions));
@@ -215,6 +218,7 @@
     }
 
     public void testEnumElt() throws Throwable {
+
         EnumEltDocument doc = EnumEltDocument.Factory.newInstance();
         doc.setEnumElt(EnumT.A);
         try {

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/ClearSelectionTest.java	Fri Jan 14 13:48:30 2005
@@ -41,7 +41,7 @@
         m_xo = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
         String exp_ns="xmlns:po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
         m_xc.selectPath(ns+" $this//po:city");
         m_xc.toNextSelection();

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/CopyTest.java	Fri Jan 14 13:48:30 2005
@@ -90,10 +90,10 @@
         XmlCursor xc0 = xobj0.newCursor();
         XmlCursor xc1 = xobj1.newCursor();
 
-        xc0.selectPath(Common.CLM_NS_XQUERY_DEFAULT + "$this//Initial");
+        xc0.selectPath(Common.CLM_NS_XQUERY_DEFAULT + " $this//Initial");
         xc0.toNextSelection();
          String sQuery=
-                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";"+
                  "$this//po:zip";
         xc1.selectPath( sQuery );
         xc1.toNextSelection();
@@ -139,7 +139,7 @@
         xc0.toNextSelection();
 
          String sQuery=
-                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";"+
                  "$this//po:zip";
         xc1.selectPath( sQuery );
         xc1.selectPath( sQuery );
@@ -182,7 +182,7 @@
         m_xo = XmlObject.Factory.parse(
                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
 
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
         m_xc = m_xo.newCursor();
         XmlCursor xc1 = m_xo.newCursor();
         m_xc.selectPath(ns+" $this//po:shipTo/po:city");
@@ -202,7 +202,7 @@
 
     public void testCopyElementToMiddleOfTEXT() throws Exception {
 
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
         String exp_ns="xmlns:po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
         m_xo = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/GetDocChangeStampTest.java	Fri Jan 14 13:48:30 2005
@@ -42,7 +42,7 @@
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc.selectPath(ns+" $this//po:city");
         m_xc.toNextSelection();
@@ -56,7 +56,7 @@
     public void testGetDocChangeStampNotChanged() throws Exception {
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc = m_xo.newCursor();
         m_xc.selectPath(ns+" $this//po:city");

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/GetNameTest.java	Fri Jan 14 13:48:30 2005
@@ -87,7 +87,7 @@
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc.selectPath(ns+" $this//po:shipTo/po:city");
         m_xc.toNextSelection();
@@ -106,7 +106,7 @@
         m_xo = XmlObject.Factory.parse(
                   JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc.selectPath(ns+" $this//po:shipTo");
         m_xc.toNextSelection();
@@ -134,7 +134,7 @@
     public void testGetNameAttrWithDefaultNamespace() throws Exception {
         m_xo = XmlObject.Factory.parse(Common.XML_FOO_NS_PREFIX);
         m_xc = m_xo.newCursor();
-        String sDefaultElemNS = "default element namespace=\"http://ecommerce.org/schema\"";
+        String sDefaultElemNS = "declare default element namespace \"http://ecommerce.org/schema\";";
         m_xc.selectPath(sDefaultElemNS + "$this//price");
         m_xc.toNextSelection();
         m_xc.toFirstAttribute();

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/GetObjectTest.java	Fri Jan 14 13:48:30 2005
@@ -69,7 +69,7 @@
                         JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
         m_xc = m_xo.newCursor();
         String sQuery=
-                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";  "+
                  "$this//po:shipTo";
         m_xc.selectPath( sQuery );
         m_xc.toNextSelection();

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/MoveTest.java	Fri Jan 14 13:48:30 2005
@@ -87,7 +87,7 @@
         xc0.toNextSelection();
 
         String sQuery=
-                "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";"+
                  "$this//po:zip";
         xc1.selectPath( sQuery );
         assertTrue( 0 < xc1.getSelectionCount());
@@ -127,7 +127,7 @@
     public void testMoveNewLocation() throws Exception {
        m_xo=XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc = m_xo.newCursor();
         XmlCursor xc1 = m_xo.newCursor();
@@ -151,7 +151,7 @@
     public void testMoveElementToMiddleOfTEXT() throws Exception {
         m_xo = XmlObject.Factory.parse(
                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
 
         m_xc = m_xo.newCursor();
         XmlCursor xc1 = m_xo.newCursor();

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/RemoveTest.java	Fri Jan 14 13:48:30 2005
@@ -101,7 +101,7 @@
                 "xbean/xmlcursor/po.xml"));
         m_xc = m_xo.newCursor();
         String sQuery=
-                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";"+
                  "$this//po:shipTo";
         m_xc.selectPath( sQuery );
         m_xc.toNextSelection();
@@ -124,7 +124,7 @@
               "xbean/xmlcursor/po.xml"));
         m_xc = m_xo.newCursor();
          String sQuery=
-                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\""+
+                 "declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";"+
                  "$this//po:shipTo";
         m_xc.selectPath( sQuery );
         m_xc.toNextSelection();

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/SelectPathTest.java	Fri Jan 14 13:48:30 2005
@@ -80,7 +80,7 @@
         m_xo = XmlObject.Factory.parse(
                  JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
         m_xc.selectPath(ns+" $this//po:ciTy");
         assertEquals(0, m_xc.getSelectionCount());
         m_xc.selectPath(ns+" $this//po:city");
@@ -91,7 +91,7 @@
         m_xo = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar(Common.TRANXML_FILE_XMLCURSOR_PO));
         m_xc = m_xo.newCursor();
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
         m_xc.selectPath(ns+" $this//po:item");
         assertEquals(2, m_xc.getSelectionCount());
     }
@@ -118,6 +118,7 @@
         // see bugs 18009 and/or 18718
         try {
             m_xc.selectPath("&GARBAGE");
+            assertEquals(0,m_xc.getSelectionCount());
             fail("Expected RuntimeException");
         } catch (RuntimeException re) {
         }

Modified: xmlbeans/trunk/test/src/xmlcursor/common/Common.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/common/Common.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/common/Common.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/common/Common.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/common/Common.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/common/Common.java	Fri Jan 14 13:48:30 2005
@@ -56,7 +56,7 @@
     public final static String TRANXML_EXAMPLEDOCS_DIR = TRANXML_DIR + "ExampleDocs/";
     public final static String CLM_NS = "http://www.tranxml.org/TranXML/Version4.0";
     public final static String CLM_XSI_NS = "xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\"";
-    public final static String CLM_NS_XQUERY_DEFAULT = "default element namespace=\"" + CLM_NS + "\"";
+    public final static String CLM_NS_XQUERY_DEFAULT = "declare default element namespace \"" + CLM_NS + "\"; ";
 
     public final static String TRANXML_FILE_CLM = TRANXML_EXAMPLEDOCS_DIR + "CarLocationMessage.xml";
     public final static String TRANXML_FILE_RBL = TRANXML_EXAMPLEDOCS_DIR + "RailBillOfLading.xml";

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/BaseXPathTest.java	Fri Jan 14 13:48:30 2005
@@ -86,7 +86,7 @@
                   "/foo/bar[number(price)+1=4]"});
 
           testMap.put("testFunctionRound",new String[]{
-        "//bar[round(price)=3]"      });
+        "//bar//*[round(text())=3]"      });
 
          testMap.put("testFunctionSum",new String[]{
         "//bar[position()=sum(price)-4]"  });

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionAuxTest.java	Fri Jan 14 13:48:30 2005
@@ -46,7 +46,7 @@
     }
 
     static String fixPath(String path){
-        return "$this"+path;
+        return path;
     }
     public void testFunctionCount_caseB() throws Exception {
 	XmlObject xDoc = XmlObject.Factory.parse(
@@ -68,8 +68,8 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
-	String	sXPath="concat(name(//bar/*),//price/text())";
-	String sExpected="price3.00";
+	String	sXPath="concat(name(/bar[position()=1]/*[position()=1]),//price[position()=1]/text())";
+	String sExpected=Common.wrapInXmlFrag("price3.00");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -81,7 +81,7 @@
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
 	String	sXPath="string-length(name(//bar/*[last()]))";
-	String sExpected="price".length()+"";
+	String sExpected=Common.wrapInXmlFrag("price".length()+"");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -91,10 +91,12 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
-	String sXPath="substring(name(//bar/*),3,3)";
-	String sExpected="ice";
+	String sXPath="substring(name(//bar[position()=1]/*[position()=1]),3,3)";
+	String sExpected=Common.wrapInXmlFrag("ice");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
+    assertEquals(XmlCursor.TokenType.TEXT,
+            m_xc.currentTokenType());
 	assertEquals(sExpected,m_xc.xmlText());
 
     }
@@ -104,8 +106,8 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
-	String sXPath="substring-after(name(//bar/*),'pr')";
-	String sExpected="ice";
+	String sXPath="substring-after(name(//bar[position()=1]/*[position()=1]),'pr')";
+	String sExpected=Common.wrapInXmlFrag("ice");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -117,8 +119,9 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
-	String	sXPath="substring-before(name(//bar/*),'ice')";
-	String sExpected="pr";
+	String	sXPath="substring-before(" +
+            "name(//bar[position()=1]/*[position()=1]),'ice')";
+	String sExpected=Common.wrapInXmlFrag("pr");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -128,8 +131,10 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price><price at=\"val1\">2</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
-	String sXPath="translate(//bar/price/text(),'200','654')";//0 is now 5 &&4?
-	String sExpected="355";
+	String sXPath="translate(//bar[position()=1]/price[position()=1]/text()," +
+            "'200'," +
+            "'654')";//0 is now 5 &&4?
+	String sExpected=Common.wrapInXmlFrag("3.55");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -139,7 +144,7 @@
 	String sXml="<foo><bar><price at=\"val0\">3.00</price></bar><bar1>3.00</bar1></foo>";
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 	String	sXPath="number(//price/text())+10";
-	String sExpected="13.00";
+	String sExpected=Common.wrapInXmlFrag("13.0");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -151,7 +156,7 @@
 	m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
 	String	sXPath="round(//bar/price[position()=1]/text())";
-	String sExpected="3";
+	String sExpected=Common.wrapInXmlFrag("3.0");
 	m_xc.selectPath(fixPath(sXPath));
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
@@ -165,28 +170,58 @@
 	 m_xc=XmlObject.Factory.parse(sXml).newCursor();
 
 	 String	sXPath="sum(//bar/price)";
-	String sExpected="5";
+	String sExpected=Common.wrapInXmlFrag("5.0");
 	m_xc.selectPath(sXPath);
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
   }
 //
 
-  public void testFunctionBoolean_caseB() throws Exception {
-	m_xc.selectPath("boolean(//foo/text())");
+    public void testFunctionBoolean_caseB_delete() throws Exception {
+        String sXml="<foo><bar>" +
+              "<price at=\"val0\">3.00</price>" +
+              "<price at=\"val1\">2</price>" +
+              "</bar><bar1>3.00</bar1></foo>";
+      m_xc=XmlObject.Factory.parse(sXml).newCursor();
+
+	 String	sXPath="boolean(//foo/text())";
+	m_xc.selectPath(sXPath);
+        System.out.println(m_xc.getSelectionCount());
+	assertTrue(m_xc.toNextSelection() );
+	assertEquals(Common.wrapInXmlFrag("false"),
+          m_xc.xmlText());
+      assertTrue(! m_xc.toNextSelection() );
+        System.out.println("DOC  "+m_xc.xmlText());
+	m_xc.clearSelections();
+    m_xc.toStartDoc();
+    m_xc.selectPath("boolean(//price/text())");
+//     m_xc.selectPath("$this//bar");
+     m_xc.toNextSelection();
+     System.out.println("HERE "+m_xc.xmlText());
+    }
+    public void testFunctionBoolean_caseB() throws Exception {
+      String sXml="<foo><bar>" +
+              "<price at=\"val0\">3.00</price>" +
+              "<price at=\"val1\">2</price>" +
+              "</bar><bar1>3.00</bar1></foo>";
+      m_xc=XmlObject.Factory.parse(sXml).newCursor();
+
+	 String	sXPath="boolean(//foo/text())";//"boolean(//foo/text())";
+	m_xc.selectPath(sXPath);
 	m_xc.toNextSelection();
-	assertEquals("false",m_xc.xmlText());
+	assertEquals(Common.wrapInXmlFrag("false"),
+            m_xc.xmlText());
 	m_xc.clearSelections();
 
        //number
        m_xc.selectPath("boolean(//price/text())");
        m_xc.toNextSelection();
-       assertEquals("true",m_xc.xmlText());
+       assertEquals(Common.wrapInXmlFrag("true"),m_xc.xmlText());
        m_xc.clearSelections();
 
 
        //number
-       m_xc.selectPath("boolean(//price/text() div 0)");
+       m_xc.selectPath("boolean(//price[position()=last()]/text() div 0)");
        m_xc.toNextSelection();
        assertEquals("false",m_xc.xmlText());
        m_xc.clearSelections();
@@ -194,7 +229,7 @@
        //node-set
        m_xc.selectPath("boolean(//price)");
        m_xc.toNextSelection();
-       assertEquals("true",m_xc.xmlText());
+       assertEquals(Common.wrapInXmlFrag("false"),m_xc.xmlText());
        m_xc.clearSelections();
 
        m_xc.selectPath("boolean(//bar1)");
@@ -207,7 +242,7 @@
  public void testFunctionFalse_caseB() throws Exception {
         m_xc=XmlObject.Factory.parse("<foo><price at=\"val0\">3.00</price></foo>").newCursor();
 	m_xc.selectPath("name(//*[boolean(text())=false()])");
-	String sExpected="foo";
+	String sExpected=Common.wrapInXmlFrag("foo");
 	m_xc.toNextSelection();
 	assertEquals(sExpected,m_xc.xmlText());
 

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathFunctionTest.java	Fri Jan 14 13:48:30 2005
@@ -78,7 +78,7 @@
            countCheck.toNextSelection();
            System.out.println(" Global count "+countCheck.xmlText());
         */
-        String sExpectedResult = "<cd>2</cd>";
+        String sExpectedResult = "<cd>2</cd>" ;
 
         x01.selectPath(ex0Simple1);
         assertEquals(1, x01.getSelectionCount());
@@ -86,7 +86,7 @@
         assertEquals(sExpectedResult, x01.xmlText());
         x01.dispose();
 
-
+        sExpectedResult = "<xml-fragment>2</xml-fragment>";
         x0.selectPath(ex0Simple);
         XPathCommon.display(x0);
         assertEquals(1, x0.getSelectionCount());
@@ -559,7 +559,7 @@
                 XmlObject.Factory.parse(
                         "<foo><div xml:lang=\"en\"><para/><price at=\"val0\">3.00</price></div></foo>")
                 .newCursor();
-          String sXPath= getQuery("testFunctionLang",1);
+          String sXPath= getQuery("testFunctionLang",0);
         m_xc.selectPath(sXPath);
         String sExpected = "<price at=\"val0\">3.00</price>";
         m_xc.toNextSelection();

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java	Fri Jan 14 13:48:30 2005
@@ -110,7 +110,7 @@
     public void testText()throws Exception{
 	String sInput="<?xml-stylesheet type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"?><br>foo<foo>text</foo></br>";
 	m_xc= XmlObject.Factory.parse(sInput).newCursor();
-	String sXPath="$this//text()";
+	String sXPath="//text()";
 	String sExpected1=Common.XMLFRAG_BEGINTAG+"foo"+Common.XMLFRAG_ENDTAG;
 	String sExpected2=Common.XMLFRAG_BEGINTAG+"text"+Common.XMLFRAG_ENDTAG;
 	m_xc.selectPath(sXPath);
@@ -119,6 +119,18 @@
 	assertEquals(m_xc.xmlText(),sExpected1);
 	m_xc.toNextSelection();
 	assertEquals(m_xc.xmlText(),sExpected2);
+    }
+
+    public void testTextObject()throws Exception{
+	String sInput="<?xml-stylesheet type=\"text/xsl\" xmlns=\"http://openuri.org/shipping/\"?><br>foo<foo>text</foo></br>";
+	m_xo= XmlObject.Factory.parse(sInput);
+	String sXPath="//text()";
+	String sExpected1=Common.XMLFRAG_BEGINTAG+"foo"+Common.XMLFRAG_ENDTAG;
+	String sExpected2=Common.XMLFRAG_BEGINTAG+"text"+Common.XMLFRAG_ENDTAG;
+	XmlObject[] res=m_xo.selectPath(sXPath);
+	assertEquals(res.length,2);
+	assertEquals(res[0].xmlText(),sExpected1);
+	assertEquals(res[1].xmlText(),sExpected2);
     }
 }
 

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathExpressionTestImpl.java	Fri Jan 14 13:48:30 2005
@@ -32,11 +32,6 @@
         super(name);
     }
 
-
-/**
-* the only difference from Jaxen queries is that we need a context to start from:
-* preped "$this" to queries
-*/
     public String getQuery(String testName, int testCase)
             throws IllegalArgumentException {
         Object queries;

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/jaxen/detailed/XPathFunctionTestImpl.java	Fri Jan 14 13:48:30 2005
@@ -29,11 +29,11 @@
     public XPathFunctionTestImpl (String name) {
         super(name);
         testMap.put("testFunctionCount",new String[]{
-            "//cd[position()=count(//cd)]",
+            "count(//cd)",
              "//cd[position()=2]"
         }) ;
          testMap.put("testFunctionLocalName",new String[]{
-        "//bar"
+        "//*[local-name(.)='bar']"
          });
          testMap.put("testFunctionConcat",new String[]{
         "//bar/*[name(.)=concat(\"pr\",\"ice\")]"
@@ -65,6 +65,14 @@
          testMap.put("testFunctionTranslate",new String[]{
         "//bar/*[translate(name(.)," +
                 "'ice','pr')=\"prpr\"]"});
+
+         testMap.put("testFunctionLang",new String[]{
+        "//price[lang(\"en\")=true()]",
+        "//foo[lang(\"en\")=true()]"}
+        );
+
+        testMap.put("testFunctionTrue",new String[]{
+        "//*[boolean(@at)=true()]"  });
     }
 
 

Modified: xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/NodeTest.java	Fri Jan 14 13:48:30 2005
@@ -76,7 +76,7 @@
     }
 
     public void testNameTestQName_1() throws XmlException {
-        String sQuery1 = "declare namespace pre=\"http://uri.com\" $this//pre:*";
+        String sQuery1 = "declare namespace pre=\"http://uri.com\"; $this//pre:*";
         XmlCursor c = XmlObject.Factory.parse(sXmlChild).newCursor();
         String sExpected =
                 "<pre:baz baz:at0=\"val1\" xmlns:baz=\"http://uri\" xmlns:pre=\"http://uri.com\"/>";
@@ -91,7 +91,7 @@
 
     //test a QName that DNE
     public void testNameTestQName_2() throws XmlException {
-        String sQuery1 = "declare namespace pre=\"http://uri\" $this//pre:baz";
+        String sQuery1 = "declare namespace pre=\"http://uri\"; $this//pre:baz";
         XmlCursor c = XmlObject.Factory.parse(sXmlChild).newCursor();
         assertEquals(XmlCursor.TokenType.START, c.toNextToken());
         c.selectPath(sQuery1);

Modified: xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java?view=diff&rev=125213&p1=xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java&r1=125212&p2=xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java&r2=125213
==============================================================================
--- xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java	(original)
+++ xmlbeans/trunk/test/src/xmlobject/checkin/ValidateTest.java	Fri Jan 14 13:48:30 2005
@@ -69,7 +69,7 @@
     public void testValidateFalseFixedAttr() throws Exception {
          m_xo = XmlObject.Factory.parse(
                 JarUtil.getResourceFromJar("xbean/xmlcursor/po.xml"));
-        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
+        String ns="declare namespace po=\"http://xbean.test/xmlcursor/PurchaseOrder\";";
                     String exp_ns="xmlns:po=\"http://xbean.test/xmlcursor/PurchaseOrder\"";
 
         m_xc = m_xo.newCursor();

Modified: xmlbeans/trunk/testbuild.xml
Url: http://svn.apache.org/viewcvs/xmlbeans/trunk/testbuild.xml?view=diff&rev=125213&p1=xmlbeans/trunk/testbuild.xml&r1=125212&p2=xmlbeans/trunk/testbuild.xml&r2=125213
==============================================================================
--- xmlbeans/trunk/testbuild.xml	(original)
+++ xmlbeans/trunk/testbuild.xml	Fri Jan 14 13:48:30 2005
@@ -99,6 +99,7 @@
         <delete dir="${build.dir.test.schemas.lib}" verbose="false" failonerror="false" includeEmptyDirs="true"/>
         <delete dir="${build.dir.test.schemas}" verbose="false" failonerror="false" includeEmptyDirs="true"/>
         <delete file="${build.dir.test.lib}/xmlcases.jar" verbose="false" failonerror="false" includeEmptyDirs="true"/>
+        <delete file="${build.dir.test.lib}/xqcases.jar" verbose="false" failonerror="false" includeEmptyDirs="true"/>
     </target>
 
     <target name="clean.reports" description="Deletes generated report files">
@@ -167,6 +168,8 @@
         <include name="**/*.xsd"/>
         <!--needed for scomp and redefine-->
         <include name="**/*.xs"/>
+         <!--needed for xquery-->
+        <include name="**/*.xq"/>
         <include name="**/*.xsddonotcompile"/>
         <include name="**/*.txt"/>
         <include name="**/*.xml"/>
@@ -264,6 +267,13 @@
             />
     </target>
 
+    <target name="build.xqcases" description="Builds xqcases.jar">
+        <jar destfile="${build.dir.test.lib}/xqcases.jar"
+            basedir="${build.dir.test.schemas}" update="false"
+            includes="xbean/xmlcursor/xquery/*.xq"
+            />
+    </target>
+
     <target name="build.xsdcases" description="Builds xmlcases.jar">
         <jar destfile="${build.dir.test.lib}/xsdcases.jar"
             basedir="${build.dir.test.schemas}" update="false"
@@ -727,6 +737,7 @@
         <property name="testcasejar.update" value="true"/>
         <echo message="SCHEMAS: ${this.schema.dirs}"/>
         <antcall target="unit.build"/>
+         <antcall target="build.xqcases"/>
     </target>
 
     <target name="build.area.dom">

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message