xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject svn commit: r227032 - in /xmlbeans/trunk/src: store/org/apache/xmlbeans/impl/store/ typeimpl/org/apache/xmlbeans/impl/schema/ xmlpublic/org/apache/xmlbeans/
Date Tue, 02 Aug 2005 16:14:09 GMT
Author: cezar
Date: Tue Aug  2 09:13:54 2005
New Revision: 227032

URL: http://svn.apache.org/viewcvs?rev=227032&view=rev
Log:
Contributed by: Yana Kadiyska. Fixing redefinition of enumerations.Adding bookmarks at end
tags

Modified:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
    xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java?rev=227032&r1=227031&r2=227032&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java Tue Aug  2 09:13:54
2005
@@ -3128,6 +3128,9 @@
             _wantLineNumbers =
                 _startLocator != null &&
                 options.hasOption(XmlOptions.LOAD_LINE_NUMBERS);
+            _wantLineNumbersAtEndElt =
+                _startLocator != null &&
+                options.hasOption(XmlOptions.LOAD_LINE_NUMBERS_END_ELEMENT);
         }
 
         public void startDocument()
@@ -3230,6 +3233,12 @@
             throws SAXException
         {
             _context.endElement();
+            if (_wantLineNumbersAtEndElt)
+            {
+                _context.bookmark(
+                    new XmlLineNumber(_startLocator.getLineNumber(),
+                        _startLocator.getColumnNumber(), -1));
+            }
         }
 
         public void characters(char ch[], int start, int length)
@@ -3342,6 +3351,7 @@
         protected LoadContext _context;
 
         private boolean _wantLineNumbers;
+        private boolean _wantLineNumbersAtEndElt;
         private Locator _startLocator;
     }
 

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?rev=227032&r1=227031&r2=227032&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
Tue Aug  2 09:13:54 2005
@@ -297,7 +297,7 @@
                 emit(" * This is a complex type.");
                 break;
             case SchemaType.ATOMIC:
-                emit(" * This is an atomic type that is a restriction of " + sType.getBaseType().getFullJavaName()
+ ".");
+                emit(" * This is an atomic type that is a restriction of " + getFullJavaName(sType)
+ ".");
                 break;
             case SchemaType.LIST:
                 emit(" * This is a list type whose items are " + sType.getListItemType().getFullJavaName()
+ ".");
@@ -312,6 +312,21 @@
         emit(" */");
     }
 
+    private String getFullJavaName(SchemaType sType)
+    {
+
+        SchemaTypeImpl sTypeI = (SchemaTypeImpl) sType;
+        String ret = sTypeI.getFullJavaName();
+
+        while (sTypeI.isRedefinition())
+        {
+            ret = sTypeI.getFullJavaName();
+            sTypeI = (SchemaTypeImpl) sTypeI.getBaseType();
+        }
+        return ret;
+    }
+
+
     public static String indexClassForSystem(SchemaTypeSystem system)
     {
         String name = system.getName();
@@ -778,13 +793,6 @@
         emit("/** " + sentence + " */");
     }
 
-    static SchemaType findBaseEnumType(SchemaType sType)
-    {
-        while (sType.getBaseType().hasStringEnumValues())
-            sType = sType.getBaseType();
-        return sType;
-    }
-
     public static String javaStringEscape(String str)
     {
         // forbidden: \n, \r, \", \\.
@@ -830,7 +838,7 @@
 
     void printStringEnumeration(SchemaType sType) throws IOException
     {
-        SchemaType baseEnumType = findBaseEnumType(sType);
+        SchemaType baseEnumType = sType.getBaseEnumType();
         String baseEnumClass = baseEnumType.getFullJavaName();
 
         if (baseEnumType == sType)

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java?rev=227032&r1=227031&r2=227032&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
Tue Aug  2 09:13:54 2005
@@ -933,7 +933,13 @@
                 enumeratedValues.toArray(new XmlAnySimpleType[enumeratedValues.size()])));
 
             SchemaType beType = sImpl;
-            if (sImpl.getBaseType().getBaseEnumType() != null)
+            if ( ((SchemaTypeImpl)sImpl).isRedefinition() ){
+                beType = sImpl.getBaseType().getBaseEnumType();
+                if( beType == null || sImpl.getBaseType() == beType ){
+                    beType = sImpl;
+                }
+            }
+            else if (sImpl.getBaseType().getBaseEnumType() != null)
                 beType = sImpl.getBaseType().getBaseEnumType();
             sImpl.setBaseEnumTypeRef(beType.getRef());
         }

Modified: xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java?rev=227032&r1=227031&r2=227032&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java (original)
+++ xmlbeans/trunk/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java Tue Aug  2 09:13:54 2005
@@ -422,6 +422,22 @@
         return set( LOAD_LINE_NUMBERS ); 
     }
 
+     /**
+     * If this option is set, line number annotations are placed
+     * in the store when parsing a document.  This is particularly
+     * useful when you want {@link XmlError} objects to contain
+     * line numbers. Use the option to load line numbers at non-default
+     * places, e.g. at the end of an element
+     *
+     * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+     * @see XmlError
+     */
+    public XmlOptions setLoadLineNumbers (String option) {
+        XmlOptions temp = setLoadLineNumbers();
+        temp = temp.set( option );
+        return temp;
+    }
+
     /**
      * This option sets a map of namespace uri substitutions that happen
      * when parsing a document.
@@ -743,6 +759,9 @@
     public static final String LOAD_STRIP_PROCINSTS            = "LOAD_STRIP_PROCINSTS";
     /** @exclude */
     public static final String LOAD_LINE_NUMBERS               = "LOAD_LINE_NUMBERS";
+    /** @exclude */
+    public static final String LOAD_LINE_NUMBERS_END_ELEMENT= "LOAD_LINE_NUMBERS_END_ELEMENT";
+
     /** @exclude */
     public static final String LOAD_SUBSTITUTE_NAMESPACES      = "LOAD_SUBSTITUTE_NAMESPACES";
     /** @exclude */



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


Mime
View raw message