You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2020/05/19 20:10:56 UTC

svn commit: r1877931 [1/9] - in /xmlbeans: site/src/documentation/content/xdocs/ trunk/ trunk/lib/ trunk/src/jamsupport/ trunk/src/store/org/apache/xmlbeans/impl/store/ trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/ trunk/src/xpath_xquery/org/apa...

Author: kiwiwings
Date: Tue May 19 20:10:55 2020
New Revision: 1877931

URL: http://svn.apache.org/viewvc?rev=1877931&view=rev
Log:
XMLBEANS-539 - Support for newer versions of Saxon as an XPath engine

Added:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrIdXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Bookmark.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CdataNode.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CharNode.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CommentXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DetailEntryXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DetailXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DocumentFragXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DocumentXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomSaver.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/ElementAttributes.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/ElementXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NamedNodeXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NodeXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/ProcInstXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SaajCdataNode.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SaajTextNode.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapBodyElementXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapBodyXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapElementXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapEnvelopeXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapFaultElementXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapFaultXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapHeaderElementXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapHeaderXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapPartDocXobj.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SoapPartDom.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/TextNode.java
    xmlbeans/trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/Parser.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/complex/checkin/XPathTestsMisc.java
Removed:
    xmlbeans/trunk/lib/
    xmlbeans/trunk/src/jamsupport/
Modified:
    xmlbeans/site/src/documentation/content/xdocs/status.xml
    xmlbeans/trunk/   (props changed)
    xmlbeans/trunk/build.xml
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cursor.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Jsr173.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Validate.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Xobj.java
    xmlbeans/trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/BindingConfigImpl.java
    xmlbeans/trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
    xmlbeans/trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/PrePostExtensionImpl.java
    xmlbeans/trunk/src/xmlconfig/org/apache/xmlbeans/impl/config/UserTypeImpl.java
    xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
    xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
    xmlbeans/trunk/test/cases/xbean/misc/jira/xmlbeans_307_maxallowedenum.xsd
    xmlbeans/trunk/test/src/misc/detailed/LargeEnumTest.java
    xmlbeans/trunk/test/src/xmlcursor/common/BasicCursorTestCase.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathCommon.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/common/XPathNodetestTest.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/complex/checkin/XPathTests.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/complex/detailed/XPathTest.java
    xmlbeans/trunk/test/src/xmlcursor/xpath/xbean_xpath/detailed/AxesTest.java
    xmlbeans/trunk/test/src/xmlcursor/xquery/detailed/XQueryVariableBindingTest.java
    xmlbeans/trunk/test/src/xmlobject/detailed/CopyTest.java

Modified: xmlbeans/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/xmlbeans/site/src/documentation/content/xdocs/status.xml?rev=1877931&r1=1877930&r2=1877931&view=diff
==============================================================================
--- xmlbeans/site/src/documentation/content/xdocs/status.xml (original)
+++ xmlbeans/site/src/documentation/content/xdocs/status.xml Tue May 19 20:10:55 2020
@@ -45,6 +45,15 @@
           was introduced without having a deprecation warning for at least 2 final releases.
           Use a value of "true" to indicate a breakage. Otherwise, omit this attribute.
     -->
+
+    <release version="4.0.0" date="2020-06-??">
+        <actions>
+            <action dev="PD" type="update" context="code" fixes-bug="XMLBEANS-539">Support for newer versions of Saxon as an XPath engine</action>
+        </actions>
+    </release>
+
+
+
     <release version="3.1.0" date="2019-03-26">
         <actions>
             <action dev="PD" type="fix" context="code" fixes-bug="XMLBEANS-502">Allow to clear all ThreadLocals from the current thread</action>

Propchange: xmlbeans/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue May 19 20:10:55 2020
@@ -8,3 +8,4 @@ XMLBeans.iws
 bin
 tmp
 compile-lib
+lib

Modified: xmlbeans/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/build.xml?rev=1877931&r1=1877930&r2=1877931&view=diff
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Tue May 19 20:10:55 2020
@@ -13,7 +13,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<project name="XMLBeans" default="process-resources" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
+<project name="XMLBeans" default="process-resources" basedir="." xmlns:unless="ant:unless">
 
     <property name="build.compiler" value="javac1.8"/>
     <property name="ant.build.javac.source" value="1.8"/>
@@ -22,20 +22,51 @@
     <property name="version.base" value="3.1.1"/>
     <property name="version.rc" value=""/>
 
-    <property name="repository.m2" value="https://repo1.maven.org"/>
+    <property name="repository.m2" value="https://repo1.maven.org/maven2"/>
     <property environment="ENV"/>
 
-    <property name="compile.lib" location="compile-lib"/>
+    <scriptdef name="dependency" language="javascript" description="define properties for library dependency">
+        <attribute name="prefix"/>
+        <attribute name="artifact"/>
+        <attribute name="usage"/>
+        <attribute name="packaging"/>
+        <attribute name="repo"/>
+        <attribute name="snapshot"/>
+        <attribute name="query"/>
+        <attribute name="target"/>
+        <![CDATA[
+            var parts = attributes.get("artifact").split(/:/);
+            var packaging = attributes.get("packaging") || "jar";
+            var version = attributes.get("snapshot") || parts[2];
+            var repo = attributes.get("repo");
+            if (repo == null) {
+                repo = project.getProperty("repository.m2");
+            }
+            var query = attributes.get("query") || "";
+            var usageDir = attributes.get("usage");
+            usageDir = project.getProperty("basedir")+(usageDir.charAt(0) == '/' ? "" : "/lib/")+usageDir;
+            var jarLoc = usageDir+"/"+(attributes.get("target")||(parts[1]+"-"+parts[2]+"."+packaging));
+            var urlLoc = repo+"/"+parts[0].replace(/\./g,"/")+"/"+parts[1]+"/"+parts[2]+"/"+
+                parts[1]+"-"+(attributes.get("snapshot") || parts[2])+"."+packaging+query;
+            project.setProperty(attributes.get("prefix")+"."+packaging, jarLoc);
+            project.setProperty(attributes.get("prefix")+".url", urlLoc);
+        ]]>
+        <!-- TODO: add library to a queue for downloading ... -->
+    </scriptdef>
+
+    <dependency prefix="old.xmlbeans" artifact="org.apache.xmlbeans:xmlbeans:3.1.0" usage="previous"/>
+    <dependency prefix="javaparser.core" artifact="com.github.javaparser:javaparser-core:3.15.21" usage="main"/>
+
 
     <!-- Apache RAT license check properties -->
     <property name="rat.reportdir" value="build/rat"/>
     <property name="rat.report" value="${rat.reportdir}/report.txt"/>
-    <property name="rat.jar" location="${compile.lib}/apache-rat-0.12.jar"/>
-    <property name="rat.url" value="${repository.m2}/maven2/org/apache/rat/apache-rat/0.12/apache-rat-0.12.jar"/>
+
+    <dependency prefix="rat" artifact="org.apache.rat:apache-rat:0.12" usage="util"/>
 
     <!-- api checks -->
-    <property name="forbidden.jar" location="${compile.lib}/forbiddenapis-2.5.jar"/>
-    <property name="forbidden.url" value="${repository.m2}/maven2/de/thetaphi/forbiddenapis/2.5/forbiddenapis-2.5.jar"/>
+    <dependency prefix="forbidden" artifact="de.thetaphi:forbiddenapis:2.6" usage="util"/>
+
 
     <!-- dependencies -->
 
@@ -44,44 +75,25 @@
         http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-7-3j.zip
         http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-8j.zip
     -->
-    <property name="saxon.zip" location="${compile.lib}/saxonb9-1-0-8j.zip"/>
-    <property name="saxon.jar" location="${compile.lib}/saxon9.jar"/>
-    <property name="saxon-dom.jar" location="${compile.lib}/saxon9-dom.jar"/>
-    <property name="saxon.url" value="https://sourceforge.net/projects/saxon/files/Saxon-B/9.1.0.8/saxonb9-1-0-8j.zip"/>
-
-    <property name="xcresolver.zip" location="${compile.lib}/xcresolver.zip"/>
-    <property name="xcresolver.jar" location="${compile.lib}/resolver.jar"/>
-    <property name="xcresolver.url" value="https://archive.apache.org/dist/xml/commons/binaries/xml-commons-resolver-1.1.zip"/>
+    <dependency prefix="saxon" artifact="net.sf.saxon:Saxon-HE:10.0" usage="tests"/>
 
     <!-- test dependencies -->
-    <property name="junit.jar" location="${compile.lib}/junit-4.12.jar"/>
-    <property name="junit.url" value="${repository.m2}/maven2/junit/junit/4.12/junit-4.12.jar"/>
-    <property name="hamcrest.jar" location="${compile.lib}/hamcrest-core-1.3.jar"/>
-    <property name="hamcrest.url" value="${repository.m2}/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
-
-    <property name="xerces.jar" location="${compile.lib}/xercesImpl-2.11.0.jar"/>
-    <property name="xerces.url" value="${repository.m2}/maven2/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar"/>
-
-    <property name="xml-apis.jar" location="${compile.lib}/xml-apis-1.4.01.jar"/>
-    <property name="xml-apis.url" value="${repository.m2}/maven2/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar"/>
-
-    <path id="saxon">
-        <pathelement location="${saxon.jar}"/>
-        <pathelement location="${saxon-dom.jar}"/>
-    </path>
+    <dependency prefix="junit" artifact="junit:junit:4.13" usage="tests"/>
+    <dependency prefix="hamcrest" artifact="org.hamcrest:hamcrest:2.2" usage="tests"/>
+    <dependency prefix="xerces" artifact="xerces:xercesImpl:2.12.0" usage="tests"/>
+    <dependency prefix="xml-apis" artifact="xml-apis:xml-apis:1.4.01" usage="tests"/>
 
     <path id="xmlbeans-test">
         <pathelement location="build/classes"/>
         <pathelement location="build/generated-resources"/>
         <dirset dir="resources" includes="*"/>
-        <path refid="saxon"/>
-        <pathelement location="${xcresolver.jar}"/>
+        <pathelement location="${saxon.jar}"/>
         <pathelement location="test/lib/w3c_domts.jar"/>
         <pathelement location="${junit.jar}"/>
         <pathelement location="${hamcrest.jar}"/>
         <pathelement location="${xerces.jar}"/>
         <pathelement location="${xml-apis.jar}"/>
-        <pathelement location="${ENV.JAVA_HOME}/lib/tools.jar"/>
+        <pathelement location="${javaparser.core.jar}"/>
     </path>
 
     <path id="sources">
@@ -101,7 +113,6 @@
         <pathelement location="src/typestore"/>
         <pathelement location="src/xmlcomp"/>
         <pathelement location="src/xmlconfig"/>
-        <pathelement location="src/jamsupport"/>
         <pathelement location="build/generated-sources"/>
     </path>
 
@@ -117,25 +128,15 @@
     </target>
 
     <target name="-check-jars" description="Removes old dependencies and verifies downloaded ones">
-        <mkdir dir="${compile.lib}"/>
         <!-- remove previous versions of third-party jars to prevent them from lingering around,
             we often had hard-to-find build/CI-problems because of these! -->
-        <delete>
-            <fileset dir="${compile.lib}">
-                <include name="saxonb8-8j.zip"/>
-                <include name="saxonb8-7-3j.zip"/>
-                <include name="saxonb8-6-1.zip"/>
-                <include name="saxonb8-2.zip"/>
-                <include name="saxonb8-1.zip"/>
-                <include name="saxon8.jar"/>
-                <include name="saxon8-dom.jar"/>
-            </fileset>
-        </delete>
+        <delete dir="compile-lib"/>
         <condition property="jars.present">
             <or>
                 <and>
+                    <available file="${old.xmlbeans.jar}"/>
+                    <available file="${javaparser.core.jar}"/>
                     <available file="${saxon.jar}"/>
-                    <available file="${xcresolver.jar}"/>
                     <available file="${junit.jar}"/>
                     <available file="${hamcrest.jar}"/>
                     <available file="${xerces.jar}"/>
@@ -150,37 +151,18 @@
         <attribute name="src"/>
         <attribute name="dest"/>
         <sequential>
-            <echo>src: @{src}</echo>
-            <echo>dest: @{dest}</echo>
-            <!--fail
-                message="Java version might be uncapable to download https URLs - see https://stackoverflow.com/questions/6851461/java-why-does-ssl-handshake-give-could-not-generate-dh-keypair-exception">
-                <condition>
-                    <and>
-                        <equals arg1="${ant.java.version}" arg2="1.6"/>
-                        <contains string="@{src}" substring="https"/>
-                    </and>
-                </condition>
-            </fail-->
+            <local name="destdir"/>
+            <dirname property="destdir" file="@{dest}"/>
+            <mkdir dir="${destdir}"/>
             <get src="@{src}" dest="@{dest}" skipexisting="true"/>
         </sequential>
     </macrodef>
 
     <target name="-fetch-jars" depends="-check-jars" unless="jars.present"
             description="Fetches needed JAR files from the Internet">
-        <downloadfile dest="${saxon.zip}" src="${saxon.url}"/>
-        <unzip src="${saxon.zip}" dest="${compile.lib}">
-            <patternset>
-                <include name="saxon9.jar"/>
-                <include name="saxon9-dom.jar"/>
-            </patternset>
-        </unzip>
-        <downloadfile dest="${xcresolver.zip}" src="${xcresolver.url}"/>
-        <unzip src="${xcresolver.zip}" dest="${compile.lib}">
-            <patternset>
-                <include name="*/resolver.jar"/>
-            </patternset>
-            <mapper type="flatten"/>
-        </unzip>
+        <downloadfile dest="${old.xmlbeans.jar}" src="${old.xmlbeans.url}"/>
+        <downloadfile dest="${javaparser.core.jar}" src="${javaparser.core.url}"/>
+        <downloadfile dest="${saxon.jar}" src="${saxon.url}"/>
         <downloadfile dest="${junit.jar}" src="${junit.url}"/>
         <downloadfile dest="${hamcrest.jar}" src="${hamcrest.url}"/>
         <downloadfile dest="${xerces.jar}" src="${xerces.url}"/>
@@ -231,20 +213,13 @@
 
     <target name="process-resources" depends="-fetch-jars" description="Generate sources and resources based on schema files">
         <mkdir dir="build/classes"/>
-
-        <copy todir="build/generated-sources/org/apache/xmlbeans/impl">
-            <zipfileset src="lib/jam-0.1.0-src.jar" includes="src/org/**"/>
-            <cutdirsmapper dirs="3"/>
-            <filterchain>
-                <replacestring from="org.codehaus.jam" to="org.apache.xmlbeans.impl.jam"/>
-            </filterchain>
-        </copy>
+        <mkdir dir="build/generated-sources"/>
 
         <!-- Note that this is tricky because it bootstraps xmlbeans on itself. -->
         <!-- The basic strategy is to rely on the oldxbeans.jar checked into lib -->
 
         <path id="oldxbean">
-            <pathelement location="lib/oldxbean.jar"/>
+            <pathelement location="${old.xmlbeans.jar}"/>
         </path>
 
         <schemaCompProd classpathref="oldxbean" dest="build/bootstrap"/>
@@ -254,7 +229,8 @@
             <src path="build/bootstrap/generated-sources"/>
             <classpath>
                 <path refid="oldxbean"/>
-                <path refid="saxon"/>
+                <pathelement location="${saxon.jar}"/>
+                <pathelement location="${javaparser.core.jar}"/>
             </classpath>
         </javac>
 
@@ -275,8 +251,9 @@
         <!-- delete old schema classes -->
         <delete dir="build/classes/org/apache/xmlbeans/impl/xb"/>
 
-        <javac destdir="build/classes" debug="true" debuglevel="lines,vars,source" includeantruntime="true" classpathref="saxon">
+        <javac destdir="build/classes" debug="true" debuglevel="lines,vars,source" includeantruntime="true">
             <src refid="sources"/>
+            <classpath path="${saxon.jar}"/>
         </javac>
     </target>
 
@@ -510,12 +487,12 @@
         <property name="prefix" value="xmlbeans-${version.base}"/>
 
         <zip destfile="build/xmlbeans-src-${version.base}-${tstamp.dist}.zip" update="false">
-            <zipfileset dir="." excludes="build/**,tmp/**,.idea/**,bin/**,lib/**,compile-lib/**,/src/shell/**,.settings/**,.project,build.javacheck.xml,release-guide.txt" prefix="${prefix}"/>
+            <zipfileset dir="." excludes="build/**,tmp/**,.idea/**,bin/**,lib/**,/src/shell/**,.settings/**,.project,build.javacheck.xml,release-guide.txt" prefix="${prefix}"/>
         	<zipfileset dir="src/shell" prefix="${prefix}/bin" />
             <zipfileset dir="build/javadocs" prefix="${prefix}/javadocs" />
         </zip>
         <tar destfile="build/xmlbeans-src-${version.base}-${tstamp.dist}.tgz" compression="gzip">
-            <tarfileset dir="." excludes="build/**,tmp/**,.idea/**,bin/**,lib/**,compile-lib/**,/src/shell/**,.settings/**,.project,build.javacheck.xml,release-guide.txt" prefix="${prefix}"/>
+            <tarfileset dir="." excludes="build/**,tmp/**,.idea/**,bin/**,lib/**,/src/shell/**,.settings/**,.project,build.javacheck.xml,release-guide.txt" prefix="${prefix}"/>
         	<tarfileset dir="src/shell" prefix="${prefix}/bin" />
             <tarfileset dir="build/javadocs" prefix="${prefix}/javadocs" />
         </tar>
@@ -524,7 +501,6 @@
             <zipfileset dir="." includes="LICENSE.txt,NOTICE.txt,docs/**" prefix="${prefix}"/>
             <zipfileset dir="samples" includes="Any/**,DateTime/**,MixedContent/**,OrderMatters/**,SchemaEnum/**,Validation/**,XQueryXPath/**,XsdConfig/**" prefix="${prefix}/samples"/>
             <zipfileset dir="src/shell" prefix="${prefix}/bin"/>
-            <zipfileset dir="compile-lib" includes="resolver.jar" prefix="${prefix}/lib"/>
             <zipfileset dir="xkit" prefix="${prefix}"/>
             <zipfileset dir="src/xsdschema/schema" includes="*.xsd" prefix="${prefix}/schemas/s4s"/>
             <zipfileset dir="src/xmlschema/schema" includes="*.xsd" prefix="${prefix}/schemas/s4s"/>
@@ -539,7 +515,6 @@
             <tarfileset dir="." includes="LICENSE.txt,NOTICE.txt,docs/**" prefix="${prefix}"/>
             <tarfileset dir="samples" includes="Any/**,DateTime/**,MixedContent/**,OrderMatters/**,SchemaEnum/**,Validation/**,XQueryXPath/**,XsdConfig/**" prefix="${prefix}/samples"/>
             <tarfileset dir="src/shell" prefix="${prefix}/bin"/>
-            <tarfileset dir="compile-lib" includes="resolver.jar" prefix="${prefix}/lib"/>
             <tarfileset dir="xkit" prefix="${prefix}"/>
             <tarfileset dir="src/xsdschema/schema" includes="*.xsd" prefix="${prefix}/schemas/s4s"/>
             <tarfileset dir="src/xmlschema/schema" includes="*.xsd" prefix="${prefix}/schemas/s4s"/>

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrIdXobj.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrIdXobj.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrIdXobj.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrIdXobj.java Tue May 19 20:10:55 2020
@@ -0,0 +1,27 @@
+/*   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.store;
+
+import javax.xml.namespace.QName;
+
+class AttrIdXobj extends AttrXobj {
+    AttrIdXobj(Locale l, QName name) {
+        super(l, name);
+    }
+
+    public boolean isId() {
+        return true;
+    }
+}

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrXobj.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrXobj.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrXobj.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/AttrXobj.java Tue May 19 20:10:55 2020
@@ -0,0 +1,70 @@
+/*   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.store;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.TypeInfo;
+
+import javax.xml.namespace.QName;
+
+class AttrXobj extends NamedNodeXobj implements Attr {
+    AttrXobj(Locale l, QName name) {
+        super(l, ATTR, DomImpl.ATTR);
+        _name = name;
+    }
+
+    Xobj newNode(Locale l) {
+        return new AttrXobj(l, _name);
+    }
+
+    //
+    public Node getNextSibling() {
+        return null;
+    }
+    //
+
+    public String getName() {
+        return DomImpl._node_getNodeName(this);
+    }
+
+    public Element getOwnerElement() {
+        return DomImpl._attr_getOwnerElement(this);
+    }
+
+    public boolean getSpecified() {
+        return DomImpl._attr_getSpecified(this);
+    }
+
+    public String getValue() {
+        return DomImpl._node_getNodeValue(this);
+    }
+
+    public void setValue(String value) {
+        DomImpl._node_setNodeValue(this, value);
+    }
+
+    // DOM Level 3
+    public TypeInfo getSchemaTypeInfo() {
+        throw new RuntimeException("DOM Level 3 Not implemented");
+    }
+
+    public boolean isId() {
+        return false;
+    }
+}
+

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Bookmark.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Bookmark.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Bookmark.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Bookmark.java Tue May 19 20:10:55 2020
@@ -0,0 +1,109 @@
+/*   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.store;
+
+import org.apache.xmlbeans.XmlCursor;
+
+class Bookmark implements XmlCursor.XmlMark {
+    boolean isOnList(Bookmark head) {
+        for (; head != null; head = head._next)
+            if (head == this)
+                return true;
+
+        return false;
+    }
+
+    Bookmark listInsert(Bookmark head) {
+        assert _next == null && _prev == null;
+
+        if (head == null)
+            head = _prev = this;
+        else {
+            _prev = head._prev;
+            head._prev = head._prev._next = this;
+        }
+
+        return head;
+    }
+
+    Bookmark listRemove(Bookmark head) {
+        assert _prev != null && isOnList(head);
+
+        if (_prev == this) {
+            head = null;
+        } else {
+            if (head == this) {
+                head = _next;
+            } else {
+                _prev._next = _next;
+            }
+
+            if (_next == null) {
+                if (head != null) {
+                    head._prev = _prev;
+                }
+            } else {
+                _next._prev = _prev;
+                _next = null;
+            }
+        }
+
+        _prev = null;
+        assert _next == null;
+
+        return head;
+    }
+
+    void moveTo(Xobj x, int p) {
+        assert isOnList(_xobj._bookmarks);
+
+        if (_xobj != x) {
+            _xobj._bookmarks = listRemove(_xobj._bookmarks);
+            x._bookmarks = listInsert(x._bookmarks);
+
+            _xobj = x;
+        }
+
+        _pos = p;
+    }
+
+    //
+    // XmlCursor.XmlMark method
+    //
+
+    public XmlCursor createCursor() {
+        if (_xobj == null) {
+            throw new IllegalStateException(
+                "Attempting to create a cursor on a bookmark that " +
+                "has been cleared or replaced.");
+        }
+
+        return Cursor.newCursor(_xobj, _pos);
+    }
+
+    //
+    //
+    //
+
+    Xobj _xobj;
+    int _pos;
+
+    Bookmark _next;
+    Bookmark _prev;
+
+    Object _key;
+    Object _value;
+}

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CdataNode.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CdataNode.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CdataNode.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CdataNode.java Tue May 19 20:10:55 2020
@@ -0,0 +1,33 @@
+/*   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.store;
+
+import org.w3c.dom.CDATASection;
+
+class CdataNode extends TextNode implements CDATASection {
+    CdataNode(Locale l) {
+        super(l);
+    }
+
+    public int nodeType() {
+        return DomImpl.CDATA;
+    }
+
+    public String name() {
+        return "#cdata-section";
+    }
+}
+

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CharNode.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CharNode.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CharNode.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CharNode.java Tue May 19 20:10:55 2020
@@ -0,0 +1,421 @@
+/*   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.store;
+
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.*;
+
+import javax.xml.namespace.QName;
+import java.io.PrintStream;
+
+abstract class CharNode implements DomImpl.Dom, Node, CharacterData {
+
+    public CharNode(Locale l) {
+        assert l != null;
+
+        _locale = l;
+    }
+
+    public QName getQName() {
+        return null;
+    }
+
+    public Locale locale() {
+        assert isValid();
+
+        return _locale == null ? ((DomImpl.Dom) _src).locale() : _locale;
+    }
+
+    public void setChars(Object src, int off, int cch) {
+        assert CharUtil.isValid(src, off, cch);
+        assert (_locale != null || _src instanceof DomImpl.Dom);
+
+        if (_locale == null) {
+            _locale = ((DomImpl.Dom) _src).locale();
+        }
+
+        _src = src;
+        _off = off;
+        _cch = cch;
+    }
+
+    public DomImpl.Dom getDom() {
+        assert isValid();
+
+        if (_src instanceof DomImpl.Dom)
+            return (DomImpl.Dom) _src;
+
+        return null;
+    }
+
+    public void setDom(DomImpl.Dom d) {
+        assert d != null;
+
+        _src = d;
+        _locale = null;
+    }
+
+    public Cur tempCur() {
+        assert isValid();
+
+        if (!(_src instanceof DomImpl.Dom))
+            return null;
+
+        Cur c = locale().tempCur();
+        c.moveToCharNode(this);
+
+        return c;
+    }
+
+    private boolean isValid() {
+        return (_src instanceof DomImpl.Dom) == (_locale == null);
+
+    }
+
+    public static boolean isOnList(CharNode nodes, CharNode node) {
+        assert node != null;
+
+        for (CharNode cn = nodes; cn != null; cn = cn._next) {
+            if (cn == node) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static CharNode remove(CharNode nodes, CharNode node) {
+        assert isOnList(nodes, node);
+
+        if (nodes == node) {
+            nodes = node._next;
+        } else {
+            node._prev._next = node._next;
+        }
+
+        if (node._next != null) {
+            node._next._prev = node._prev;
+        }
+
+        node._prev = node._next = null;
+
+        return nodes;
+    }
+
+    public static CharNode insertNode(CharNode nodes, CharNode newNode, CharNode before) {
+        assert !isOnList(nodes, newNode);
+        assert before == null || isOnList(nodes, before);
+        assert newNode != null;
+        assert newNode._prev == null && newNode._next == null;
+
+        if (nodes == null) {
+            assert before == null;
+            nodes = newNode;
+        } else if (nodes == before) {
+            nodes._prev = newNode;
+            newNode._next = nodes;
+            nodes = newNode;
+        } else {
+            CharNode n = nodes;
+
+            while (n._next != before)
+                n = n._next;
+
+            if ((newNode._next = n._next) != null)
+                n._next._prev = newNode;
+
+            newNode._prev = n;
+            n._next = newNode;
+        }
+
+        return nodes;
+    }
+
+    public static CharNode appendNode(CharNode nodes, CharNode newNode) {
+        return insertNode(nodes, newNode, null);
+    }
+
+    public static CharNode appendNodes(CharNode nodes, CharNode newNodes) {
+        assert newNodes != null;
+        assert newNodes._prev == null;
+
+        if (nodes == null)
+            return newNodes;
+
+        CharNode n = nodes;
+
+        while (n._next != null)
+            n = n._next;
+
+        n._next = newNodes;
+        newNodes._prev = n;
+
+        return nodes;
+    }
+
+    public static CharNode copyNodes(CharNode nodes, Object newSrc) {
+        CharNode newNodes = null;
+
+        for (CharNode n = null; nodes != null; nodes = nodes._next) {
+            CharNode newNode;
+
+            if (nodes instanceof TextNode)
+                newNode = nodes.locale().createTextNode();
+            else
+                newNode = nodes.locale().createCdataNode();
+
+            // How to deal with entity refs??
+
+            newNode.setChars(newSrc, nodes._off, nodes._cch);
+
+            if (newNodes == null)
+                newNodes = newNode;
+
+            if (n != null) {
+                n._next = newNode;
+                newNode._prev = n;
+            }
+
+            n = newNode;
+        }
+
+        return newNodes;
+    }
+
+    public boolean nodeCanHavePrefixUri() {
+        return false;
+    }
+
+    public boolean isNodeAftertext() {
+        assert _src instanceof Xobj :
+            "this method is to only be used for nodes backed up by Xobjs";
+        Xobj src = (Xobj) _src;
+        return src._charNodesValue == null ? true :
+            src._charNodesAfter == null ? false :
+                CharNode.isOnList(src._charNodesAfter, this);
+    }
+
+    public void dump(PrintStream o, Object ref) {
+        if (_src instanceof DomImpl.Dom)
+            ((DomImpl.Dom) _src).dump(o, ref);
+        else
+            o.println("Lonely CharNode: \"" + CharUtil.getString(_src, _off, _cch) + "\"");
+    }
+
+    public void dump(PrintStream o) {
+        dump(o, (Object) this);
+    }
+
+    public void dump() {
+        dump(System.out);
+    }
+
+    public Node appendChild(Node newChild) {
+        return DomImpl._node_appendChild(this, newChild);
+    }
+
+    public Node cloneNode(boolean deep) {
+        return DomImpl._node_cloneNode(this, deep);
+    }
+
+    public NamedNodeMap getAttributes() {
+        return null;
+    }
+
+    public NodeList getChildNodes() {
+        return DomImpl._emptyNodeList;
+    }
+
+    public Node getParentNode() {
+        return DomImpl._node_getParentNode(this);
+    }
+
+    public Node removeChild(Node oldChild) {
+        return DomImpl._node_removeChild(this, oldChild);
+    }
+
+    public Node getFirstChild() {
+        return null;
+    }
+
+    public Node getLastChild() {
+        return null;
+    }
+
+    public String getLocalName() {
+        return DomImpl._node_getLocalName(this);
+    }
+
+    public String getNamespaceURI() {
+        return DomImpl._node_getNamespaceURI(this);
+    }
+
+    public Node getNextSibling() {
+        return DomImpl._node_getNextSibling(this);
+    }
+
+    public String getNodeName() {
+        return DomImpl._node_getNodeName(this);
+    }
+
+    public short getNodeType() {
+        return DomImpl._node_getNodeType(this);
+    }
+
+    public String getNodeValue() {
+        return DomImpl._node_getNodeValue(this);
+    }
+
+    public Document getOwnerDocument() {
+        return DomImpl._node_getOwnerDocument(this);
+    }
+
+    public String getPrefix() {
+        return DomImpl._node_getPrefix(this);
+    }
+
+    public Node getPreviousSibling() {
+        return DomImpl._node_getPreviousSibling(this);
+    }
+
+    public boolean hasAttributes() {
+        return false;
+    }
+
+    public boolean hasChildNodes() {
+        return false;
+    }
+
+    public Node insertBefore(Node newChild, Node refChild) {
+        return DomImpl._node_insertBefore(this, newChild, refChild);
+    }
+
+    public boolean isSupported(String feature, String version) {
+        return DomImpl._node_isSupported(this, feature, version);
+    }
+
+    public void normalize() {
+        DomImpl._node_normalize(this);
+    }
+
+    public Node replaceChild(Node newChild, Node oldChild) {
+        return DomImpl._node_replaceChild(this, newChild, oldChild);
+    }
+
+    public void setNodeValue(String nodeValue) {
+        DomImpl._node_setNodeValue(this, nodeValue);
+    }
+
+    public void setPrefix(String prefix) {
+        DomImpl._node_setPrefix(this, prefix);
+    }
+
+    // DOM Level 3
+    public Object getUserData(String key) {
+        return DomImpl._node_getUserData(this, key);
+    }
+
+    public Object setUserData(String key, Object data, UserDataHandler handler) {
+        return DomImpl._node_setUserData(this, key, data, handler);
+    }
+
+    public Object getFeature(String feature, String version) {
+        return DomImpl._node_getFeature(this, feature, version);
+    }
+
+    public boolean isEqualNode(Node arg) {
+        return DomImpl._node_isEqualNode(this, arg);
+    }
+
+    public boolean isSameNode(Node arg) {
+        return DomImpl._node_isSameNode(this, arg);
+    }
+
+    public String lookupNamespaceURI(String prefix) {
+        return DomImpl._node_lookupNamespaceURI(this, prefix);
+    }
+
+    public String lookupPrefix(String namespaceURI) {
+        return DomImpl._node_lookupPrefix(this, namespaceURI);
+    }
+
+    public boolean isDefaultNamespace(String namespaceURI) {
+        return DomImpl._node_isDefaultNamespace(this, namespaceURI);
+    }
+
+    public void setTextContent(String textContent) {
+        DomImpl._node_setTextContent(this, textContent);
+    }
+
+    public String getTextContent() {
+        return DomImpl._node_getTextContent(this);
+    }
+
+    public short compareDocumentPosition(Node other) {
+        return DomImpl._node_compareDocumentPosition(this, other);
+    }
+
+    public String getBaseURI() {
+        return DomImpl._node_getBaseURI(this);
+    }
+
+    public void appendData(String arg) {
+        DomImpl._characterData_appendData(this, arg);
+    }
+
+    public void deleteData(int offset, int count) {
+        DomImpl._characterData_deleteData(this, offset, count);
+    }
+
+    public String getData() {
+        return DomImpl._characterData_getData(this);
+    }
+
+    public int getLength() {
+        return DomImpl._characterData_getLength(this);
+    }
+
+    public void insertData(int offset, String arg) {
+        DomImpl._characterData_insertData(this, offset, arg);
+    }
+
+    public void replaceData(int offset, int count, String arg) {
+        DomImpl._characterData_replaceData(this, offset, count, arg);
+    }
+
+    public void setData(String data) {
+        DomImpl._characterData_setData(this, data);
+    }
+
+    public String substringData(int offset, int count) {
+        return DomImpl._characterData_substringData(this, offset, count);
+    }
+
+    Object getObject() {
+        return _src;
+    }
+
+    private Locale _locale;
+
+    CharNode _next;
+    CharNode _prev;
+
+    private Object _src;
+
+    int _off;
+    int _cch;
+}
+

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CommentXobj.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CommentXobj.java?rev=1877931&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CommentXobj.java (added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/CommentXobj.java Tue May 19 20:10:55 2020
@@ -0,0 +1,71 @@
+/*   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.store;
+
+import org.w3c.dom.Comment;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+class CommentXobj extends NodeXobj implements Comment {
+    CommentXobj(Locale l) {
+        super(l, COMMENT, DomImpl.COMMENT);
+    }
+
+    Xobj newNode(Locale l) {
+        return new CommentXobj(l);
+    }
+
+    public NodeList getChildNodes() {
+        return DomImpl._emptyNodeList;
+    }
+
+    public void appendData(String arg) {
+        DomImpl._characterData_appendData(this, arg);
+    }
+
+    public void deleteData(int offset, int count) {
+        DomImpl._characterData_deleteData(this, offset, count);
+    }
+
+    public String getData() {
+        return DomImpl._characterData_getData(this);
+    }
+
+    public int getLength() {
+        return DomImpl._characterData_getLength(this);
+    }
+
+    public Node getFirstChild() {
+        return null;
+    }
+
+    public void insertData(int offset, String arg) {
+        DomImpl._characterData_insertData(this, offset, arg);
+    }
+
+    public void replaceData(int offset, int count, String arg) {
+        DomImpl._characterData_replaceData(this, offset, count, arg);
+    }
+
+    public void setData(String data) {
+        DomImpl._characterData_setData(this, data);
+    }
+
+    public String substringData(int offset, int count) {
+        return DomImpl._characterData_substringData(this, offset, count);
+    }
+}
+



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