xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkro...@apache.org
Subject svn commit: r149472 - xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
Date Wed, 02 Feb 2005 03:17:28 GMT
Author: kkrouse
Date: Tue Feb  1 19:17:27 2005
New Revision: 149472

URL: http://svn.apache.org/viewcvs?view=rev&rev=149472
Log:
merge of change 149470 from trunk to 1.x branch
  XMLBEANS-105: NPE while initializing a type system w/ a type that extends an a complex type
from a different type system
  save external type signatures out instead of just type QNames

  reviewed: radup
  checkintest: passes

merge of change 125456 from trunk to 1.x branch
  Fixed http://issues.apache.org/jira/browse/XMLBEANS-23


Modified:
    xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java

Modified: xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java?view=diff&r1=149471&r2=149472
==============================================================================
--- xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
(original)
+++ xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
Tue Feb  1 19:17:27 2005
@@ -1452,9 +1452,24 @@
                 case 'D': // _XD_ - external identity constraint
                     return _linker.findIdentityConstraintRef(QNameHelper.forPretty(handle,
4));
                 case 'R': // _XR_ - external ref to attribute's type
-                    return _linker.findAttribute(QNameHelper.forPretty(handle, 4)).getType().getRef();
+                    // deprecated: replaced by _XY_
+                    SchemaGlobalAttribute attr = _linker.findAttribute(QNameHelper.forPretty(handle,
4));
+                    if (attr == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve attribute for
handle " + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return attr.getType().getRef();
                 case 'S': // _XS_ - external ref to element's type
-                    return _linker.findElement(QNameHelper.forPretty(handle, 4)).getType().getRef();
+                    // deprecated: replaced by _XY_
+                    SchemaGlobalElement elem = _linker.findElement(QNameHelper.forPretty(handle,
4));
+                    if (elem == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve element for handle
" + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return elem.getType().getRef();
+                case 'O': // _XO_ - external ref to document type
+                    return _linker.findDocumentTypeRef(QNameHelper.forPretty(handle, 4));
+                case 'Y': // _XY_ - external ref to any possible type
+                    SchemaType type = _linker.typeForSignature(handle.substring(4));
+                    if (type == null)
+                        throw new SchemaTypeLoaderException("Cannot resolve type for handle
" + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+                    return type.getRef();
                 default:
                     throw new SchemaTypeLoaderException("Cannot resolve handle " + handle,
_name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
             }
@@ -1498,22 +1513,23 @@
                     // uses ref to refer to an attribute or element in another
                     // schema and the type of that attribute or element
                     // is an anonymous (local) type
+                    // kkrouse 02/1/2005: _XR_ and _XS_ refs are replaced by _XY_
                     if (type.getName() != null)
                     {
                         writeString("_XT_" + QNameHelper.pretty(type.getName()));
                     }
+                    else if (type.isDocumentType())
+                    {
+                        // Substitution groups will create document types that
+                        // extend from other document types, possibly in
+                        // different jars
+                        writeString("_XO_" + QNameHelper.pretty(type.getDocumentElementName()));
+                    }
                     else
                     {
-                        SchemaField sf = type.getContainerField();
-                        assert (sf != null);
-                        if (sf.isAttribute())
-                        {
-                            writeString("_XR_" + QNameHelper.pretty(sf.getName()));
-                        }
-                        else
-                        {
-                            writeString("_XS_" + QNameHelper.pretty(sf.getName()));
-                        }
+                        // fix for XMLBEANS-105:
+                        // save out the external type reference using the type's signature.
+                        writeString("_XY_" + type.toString());
                     }
 
                     return;



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


Mime
View raw message