From commitsdustinhughes@example.org Sun Nov 05 00:01:06 2006
Return-Path: <commitsdustinhughes@example.org>
Delivered-To: dustinhughes@example.org
Received: (qmail 56974 invoked from network); 5 Nov 2006 00:01:06 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 5 Nov 2006 00:01:06 -0000
Received: (qmail 21737 invoked by uid 500); 5 Nov 2006 00:01:17 -0000
Delivered-To: dustinhughes@example.org
Received: (qmail 21714 invoked by uid 500); 5 Nov 2006 00:01:17 -0000
Mailing-List: contact dustinhughes@example.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:dustinhughes@example.org>
List-Help: <mailto:dustinhughes@example.org>
List-Unsubscribe: <mailto:dustinhughes@example.org>
Reply-To: dustinhughes@example.org
List-Id: <commits.xmlbeans.apache.org>
Delivered-To: mailing list dustinhughes@example.org
Received: (qmail 21703 invoked by uid 99); 5 Nov 2006 00:01:17 -0000
Received: from herse.apache.org (HELO herse.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Nov 2006 16:01:17 -0800
X-ASF-Spam-Status: No, hits=-9.4 required=10.0
	tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Nov 2006 16:01:05 -0800
Received: by eris.apache.org (Postfix, from userid 65534)
	id 71A411A9846; Sat,  4 Nov 2006 16:00:39 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r471299 - in /xmlbeans/trunk: build.xml
 src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
 src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
Date: Sun, 05 Nov 2006 00:00:39 -0000
To: dustinhughes@example.org
From: dustinhughes@example.org
X-Mailer: svnmailer-1.1.0
Message-Id: <dustinhughes@example.org>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: radup
Date: Sat Nov  4 16:00:38 2006
New Revision: 471299

URL: http://svn.apache.org/viewvc?view=rev&rev=471299
Log:
Improved handling of errors during typesystem loading. 
Fixed bug during type generation of complex types with simpe content.

Modified:
    xmlbeans/trunk/build.xml
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java

Modified: xmlbeans/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/build.xml?view=diff&rev=471299&r1=471298&r2=471299
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Sat Nov  4 16:00:38 2006
@@ -754,7 +754,7 @@
 
     <target name="xsdschema.check">
         <condition property="xsdschema.notRequired">
-            <uptodate property="xsdschema.notRequired" targetfile="build/classes/xsdschema/schema/system/sXMLSCHEMA/index.xsb">
+            <uptodate property="xsdschema.notRequired" targetfile="build/classes/xsdschema">
                 <srcfiles dir="src/xsdschema" includes="**/*.xsd*"/>
             </uptodate>
         </condition>
@@ -778,7 +778,7 @@
          ant "replace" mechanism is too difficult to use to be worth it -->
     <target name="xmlschema.check">
         <condition property="xmlschema.notRequired">
-            <uptodate property="xmlschema.notRequired" targetfile="build/classes/xmlschema/schema/system/sXMLLANG/index.xsb">
+            <uptodate property="xmlschema.notRequired" targetfile="build/classes/xmlschema">
                 <srcfiles dir="src/xmlschema" includes="**/*.xsd*"/>
             </uptodate>
         </condition>
@@ -814,7 +814,7 @@
     <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">
+        <uptodate property="configschema.notRequired" targetfile="build/classes/configschema">
             <srcfiles dir="src/configschema" includes="**/*.xsd"/>
         </uptodate>
     </target>
@@ -835,7 +835,7 @@
     <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">
+        <uptodate property="toolschema.notRequired" targetfile="build/classes/toolschema">
             <srcfiles dir="src/toolschema" includes="**/*.xsd"/>
         </uptodate>
     </target>

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?view=diff&rev=471299&r1=471298&r2=471299
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Sat Nov  4 16:00:38 2006
@@ -21,13 +21,11 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Iterator;
 
 import javax.xml.namespace.QName;
 import org.apache.xmlbeans.impl.common.NameUtil;
@@ -2437,8 +2435,33 @@
                 // in order to handle the case (for ints or string enums e.g.) where
                 // there is a simple type restriction.  So property getters need to
                 // be implemented "from scratch" for each derived complex type
+                // Moreover, attribute or element properties can be removed via restriction,
+                // but we still need to implement them because this class is supposed to
+                // also implement all the interfaces
+                SchemaType baseType = sType.getBaseType();
+                List extraProperties = null;
+                while (!baseType.isSimpleType() && !baseType.isBuiltinType())
+                {
+                    SchemaProperty[] baseProperties = baseType.getDerivedProperties();
+                    for (int i = 0; i < baseProperties.length; i++)
+                        if (!(baseProperties[i].isAttribute() &&
+                                sType.getAttributeProperty(baseProperties[i].getName()) != null))
+                        {
+                            if (extraProperties == null)
+                                extraProperties = new ArrayList();
+                            extraProperties.add(baseProperties[i]);
+                        }
+                    baseType = baseType.getBaseType();
+                }
 
                 properties = sType.getProperties();
+                if (extraProperties != null)
+                {
+                    for (int i = 0; i < properties.length; i++)
+                        extraProperties.add(properties[i]);
+                    properties = (SchemaProperty[]) extraProperties.
+                        toArray(new SchemaProperty[extraProperties.size()]);
+                }
             }
             else
             {

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java?view=diff&rev=471299&r1=471298&r2=471299
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java Sat Nov  4 16:00:38 2006
@@ -180,7 +180,20 @@
         _classloader = indexclass.getClassLoader();
         _linker = SchemaTypeLoaderImpl.build(null, null, _classloader);
         _resourceLoader = new ClassLoaderResourceLoader(_classloader);
-        initFromHeader();
+        try
+        {
+            initFromHeader();
+        }
+        catch (RuntimeException e)
+        {
+            XBeanDebug.logException(e);
+            throw e;
+        }
+        catch (Error e)
+        {
+            XBeanDebug.logException(e);
+            throw e;
+        }
         XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Finished loading type system " + _name, -1);
     }
 
@@ -2227,6 +2240,16 @@
             return _resourceLoader.getResourceAsStream(resourcename);
         }
 
+        void checkContainerNotNull(SchemaContainer container, QName name)
+        {
+            if (container == null)
+            {
+                throw new LinkageError("Loading of resource " + _name + '.' + _handle +
+                    "failed, information from " + _name + ".index.xsb is " +
+                    " out of sync (or conflicting index files found)");
+            }
+        }
+
         /**
          * Finishes loading an element after the header has already been loaded.
          */
@@ -2244,7 +2267,7 @@
                 QNameSet transitionRules = readQNameSet();
                 QName name = readQName();
                 SchemaContainer container = getContainer(name.getNamespaceURI());
-                assert container != null;
+                checkContainerNotNull(container, name);
                 SchemaGlobalElementImpl impl = new SchemaGlobalElementImpl(container);
                 impl.setParticleType(particleType);
                 impl.setMinOccurs(minOccurs);
@@ -2303,7 +2326,7 @@
             {
                 QName name = readQName();
                 SchemaContainer container = getContainer(name.getNamespaceURI());
-                assert container != null;
+                checkContainerNotNull(container, name);
                 SchemaGlobalAttributeImpl impl = new SchemaGlobalAttributeImpl(container);
                 loadAttribute(impl, name, container);
                 impl.setFilename(readString());
@@ -2328,7 +2351,7 @@
         {
             QName name = readQName();
             SchemaContainer container = getContainer(name.getNamespaceURI());
-            assert container != null;
+            checkContainerNotNull(container, name);
             SchemaModelGroupImpl impl = new SchemaModelGroupImpl(container);
 
             try
@@ -2361,7 +2384,7 @@
             try {
                 QName name = readQName();
                 SchemaContainer container = getContainer(name.getNamespaceURI());
-                assert container != null;
+                checkContainerNotNull(container, name);
                 SchemaIdentityConstraintImpl impl = new SchemaIdentityConstraintImpl(container);
                 impl.setName(name);
                 impl.setConstraintCategory(readShort());
@@ -2409,7 +2432,7 @@
         {
             QName name = readQName();
             SchemaContainer container = getContainer(name.getNamespaceURI());
-            assert container != null;
+            checkContainerNotNull(container, name);
             SchemaAttributeGroupImpl impl = new SchemaAttributeGroupImpl(container);
 
             try
@@ -2642,7 +2665,7 @@
                 if (impl.getName() != null)
                 {
                     SchemaContainer container = getContainer(impl.getName().getNamespaceURI());
-                    assert container != null;
+                    checkContainerNotNull(container, impl.getName());
                     impl.setContainer(container);
                 }
                 else if (impl.isDocumentType())
@@ -2651,7 +2674,7 @@
                     if (name != null)
                     {
                         SchemaContainer container = getContainer(name.getNamespaceURI());
-                        assert container != null;
+                        checkContainerNotNull(container, name);
                         impl.setContainer(container);
                     }
                 }
@@ -2661,7 +2684,7 @@
                     if (name != null)
                     {
                         SchemaContainer container = getContainer(name.getNamespaceURI());
-                        assert container != null;
+                        checkContainerNotNull(container, name);
                         impl.setContainer(container);
                     }
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dustinhughes@example.org
For additional commands, e-mail: dustinhughes@example.org


From commitsdustinhughes@example.org Thu Nov 16 17:52:28 2006
Return-Path: <commitsdustinhughes@example.org>
Delivered-To: dustinhughes@example.org
Received: (qmail 96334 invoked from network); 16 Nov 2006 17:52:26 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 16 Nov 2006 17:52:26 -0000
Received: (qmail 61491 invoked by uid 500); 16 Nov 2006 17:52:16 -0000
Delivered-To: dustinhughes@example.org
Received: (qmail 61464 invoked by uid 500); 16 Nov 2006 17:52:16 -0000
Mailing-List: contact dustinhughes@example.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:dustinhughes@example.org>
List-Help: <mailto:dustinhughes@example.org>
List-Unsubscribe: <mailto:dustinhughes@example.org>
Reply-To: dustinhughes@example.org
List-Id: <commits.xmlbeans.apache.org>
Delivered-To: mailing list dustinhughes@example.org
Received: (qmail 61391 invoked by uid 99); 16 Nov 2006 17:52:16 -0000
Received: from herse.apache.org (HELO herse.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 09:52:16 -0800
X-ASF-Spam-Status: No, hits=-9.4 required=10.0
	tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 09:52:04 -0800
Received: by eris.apache.org (Postfix, from userid 65534)
	id 195CA1A9846; Thu, 16 Nov 2006 09:51:33 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r475835 - in
 /xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl:
 xpath/saxon/XBeansXPath.java xquery/saxon/XBeansXQuery.java
Date: Thu, 16 Nov 2006 17:51:32 -0000
To: dustinhughes@example.org
From: dustinhughes@example.org
X-Mailer: svnmailer-1.1.0
Message-Id: <dustinhughes@example.org>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: radup
Date: Thu Nov 16 09:51:32 2006
New Revision: 475835

URL: http://svn.apache.org/viewvc?view=rev&rev=475835
Log:
Changed the XQuery/XPath support to work with Saxon 8.8 too.

Modified:
    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

Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java?view=diff&rev=475835&r1=475834&r2=475835
==============================================================================
--- xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java (original)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xpath/saxon/XBeansXPath.java Thu Nov 16 09:51:32 2006
@@ -51,6 +51,7 @@
         _contextVar = contextVar;
         this.defaultNS = defaultNS;
         this.namespaceMap = namespaceMap.entrySet().toArray();
+        this.needsDomSourceWrapping = needsDOMSourceWrapping();
     }
 
     /**
@@ -101,7 +102,7 @@
             xpe.setStaticContext(sc);
 
             Variable thisVar = sc.declareVariable(_contextVar);
-            thisVar.setValue(rootNode);
+            thisVar.setValue(needsDomSourceWrapping ? rootNode : node);
 
             XPathExpression exp = xpe.createExpression(_queryExpr);
 
@@ -131,6 +132,33 @@
         return selectNodes(node);
     }
 
+    /**
+     * @return true if we are dealing with a version of Saxon 8.x where x<=6
+     */
+    private static boolean needsDOMSourceWrapping()
+    {
+        int saxonMinorVersion;
+        int saxonMajorVersion;
+        String versionString = net.sf.saxon.Version.getProductVersion();
+        int dot1 = versionString.indexOf('.');
+        if (dot1 < 0)
+            return false;
+        int dot2 = versionString.indexOf('.', dot1 + 1);
+        if (dot2 < 0)
+            return false;
+        try
+        {
+            saxonMajorVersion = Integer.parseInt(versionString.substring(0, dot1));
+            saxonMinorVersion = Integer.parseInt(versionString.substring(dot1 + 1, dot2));
+            return saxonMajorVersion == 8 && saxonMinorVersion <= 6;
+        }
+        catch (NumberFormatException nfe)
+        {
+            return false;
+        }
+    }
+
+    private boolean needsDomSourceWrapping;
     private Object[] namespaceMap;
     private String _queryExpr;
     private String _contextVar;

Modified: xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java?view=diff&rev=475835&r1=475834&r2=475835
==============================================================================
--- xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java (original)
+++ xmlbeans/trunk/src/xpath_xquery/org/apache/xmlbeans/impl/xquery/saxon/XBeansXQuery.java Thu Nov 16 09:51:32 2006
@@ -46,6 +46,7 @@
      */
     public XBeansXQuery(String queryExpr, String contextVar, Integer boundary)
     {
+        this.needsDomSourceWrapping = needsDOMSourceWrapping();
         this.config = new Configuration();
         config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
         this._stcContext = new StaticQueryContext(config);
@@ -87,11 +88,18 @@
                     Map.Entry entry = (Map.Entry) it.next();
                     if (entry.getValue() instanceof XmlTokenSource)
                     {
-                        DOMSource domSource;
-                        domSource = new DOMSource(((XmlTokenSource)
-                            entry.getValue()).getDomNode());
+                        Object paramObject;
+                        // Saxon 8.6.1 requires that the Node be wrapped
+                        // into a DOMSource, while later versions require that
+                        // it not be
+                        if (needsDomSourceWrapping)
+                            paramObject = new DOMSource(((XmlTokenSource)
+                                entry.getValue()).getDomNode());
+                        else
+                            paramObject = ((XmlTokenSource) entry.getValue()).
+                                getDomNode();
                         dynamicContext.setParameter((String) entry.getKey(),
-                            domSource);
+                                paramObject);
                     }
                     else if (entry.getValue() instanceof String)
                     dynamicContext.setParameter((String) entry.getKey(),
@@ -118,10 +126,37 @@
         }
     }
 
+    /**
+     * @return true if we are dealing with a version of Saxon 8.x where x<=6
+     */
+    private static boolean needsDOMSourceWrapping()
+    {
+        int saxonMinorVersion;
+        int saxonMajorVersion;
+        String versionString = net.sf.saxon.Version.getProductVersion();
+        int dot1 = versionString.indexOf('.');
+        if (dot1 < 0)
+            return false;
+        int dot2 = versionString.indexOf('.', dot1 + 1);
+        if (dot2 < 0)
+            return false;
+        try
+        {
+            saxonMajorVersion = Integer.parseInt(versionString.substring(0, dot1));
+            saxonMinorVersion = Integer.parseInt(versionString.substring(dot1 + 1, dot2));
+            return saxonMajorVersion == 8 && saxonMinorVersion <= 6;
+        }
+        catch (NumberFormatException nfe)
+        {
+            return false;
+        }
+    }
+
     private XQueryExpression _xquery;
     private String _query;
     private String _contextVar;
     private StaticQueryContext _stcContext;
     private Configuration config;
     private int boundary;
+    private boolean needsDomSourceWrapping;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dustinhughes@example.org
For additional commands, e-mail: dustinhughes@example.org



{'source': 'Apache Software Foundation Public Mail Archives'}