jkesselm    02/05/01 12:41:14

  Modified:    java/src/org/apache/xml/dtm/ref Tag: Xalan3
                        ExpandedNameTable.java
                        IncrementalSAXSource_Xerces.java
               java/src/org/apache/xml/dtm/ref/xni2dtm Tag: Xalan3
                        XNI2DTM.java
  Log:
  Make sure current version checked in before I start experimenting with 
alternatives.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.10.2  +45 -10    
xml-xalan/java/src/org/apache/xml/dtm/ref/ExpandedNameTable.java
  
  Index: ExpandedNameTable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/ExpandedNameTable.java,v
  retrieving revision 1.3.10.1
  retrieving revision 1.3.10.2
  diff -u -r1.3.10.1 -r1.3.10.2
  --- ExpandedNameTable.java    29 Apr 2002 17:49:32 -0000      1.3.10.1
  +++ ExpandedNameTable.java    1 May 2002 19:41:14 -0000       1.3.10.2
  @@ -168,7 +168,8 @@
         namespace = "";
         if (null == localName) 
         localName = "";
  -    for (int i = 0; i < m_extendedTypes.size(); i++)
  +      int length=m_extendedTypes.size();
  +    for (int i = 0; i < length; i++)
       {
         ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt(i);
         if( type == etype.nodetype && namespace.equals(etype.namespace) && 
localName.equals(etype.localName)) 
  @@ -221,7 +222,7 @@
      * @param ExpandedNameID an ID that represents an expanded-name.
      * @return The id of this local name.
      */
  -  public /*static*/ final int getLocalNameID(int ExpandedNameID)
  +  public /*static*/ /*final*/ int getLocalNameID(int ExpandedNameID)
     {
       //return (ExpandedNameID & MASK_LOCALNAME);
       ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt 
(ExpandedNameID);
  @@ -254,7 +255,7 @@
      * @param ExpandedNameID an ID that represents an expanded-name.
      * @return The id of this namespace.
      */
  -  public /*static*/ final int getNamespaceID(int ExpandedNameID)
  +  public /*static*/ /*final*/ int getNamespaceID(int ExpandedNameID)
     {
       //return (ExpandedNameID & MASK_NAMESPACE) >> BITS_PER_LOCALNAME;
       ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt 
(ExpandedNameID);
  @@ -270,24 +271,58 @@
      * @param ExpandedNameID an ID that represents an expanded-name.
      * @return The id of this local name.
      */
  -  public final short getType(int ExpandedNameID)
  +  public /*final*/ short getType(int ExpandedNameID)
     {
       //return (short)(ExpandedNameID >> ROTAMOUNT_TYPE);
       ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt 
(ExpandedNameID);
       return (short)etype.nodetype;
     }
     
  +  /**
  +   * Given an expanded-name ID, return the default schema type object
  +   *
  +   * @param ExpandedNameID an ID that represents an expanded-name.
  +   * @return a schema type object -- probably an XNI PSVI type.
  +   */
  +  public /*final*/ Object getSchemaType(int ExpandedNameID)
  +  {
  +    ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt 
(ExpandedNameID);
  +    return etype.schemaType;
  +  }
  +  
  +  /**
  +   * Given an expanded-name ID, set the default schema type object if not
  +   * previously set.
  +   *
  +   * @param ExpandedNameID an ID that represents an expanded-name.
  +   * @param schemaType a schema type object -- probably an XNI PSVI type.
  +   * @return false if previously set to something different
  +   *  (as determined by Object.equals), otherwise true.
  +   */
  +  public /*final*/ boolean getSchemaType(int ExpandedNameID, Object 
schemaType)
  +  {
  +    ExtendedType etype = (ExtendedType)m_extendedTypes.elementAt 
(ExpandedNameID);
  +    Object oldtype=etype.schemaType;
  +    if(oldtype==null)
  +    {
  +      etype.schemaType=schemaType;
  +      return true;
  +    }
  +    else return oldtype.equals(schemaType);
  +  }
  +  
     
     /**
  -   * Private class representing an extended type object 
  +   * Inner class representing an extended type object.
      */
  -  private class ExtendedType
  +   class ExtendedType
     {
  -    private int nodetype;
  -    private String namespace;
  -    private String localName;
  +     int nodetype;
  +     String namespace;
  +     String localName;
  +    Object schemaType=null; // Default, for XNI PSVI support
       
  -    private ExtendedType (int nodetype, String namespace, String localName)
  +     ExtendedType (int nodetype, String namespace, String localName)
       {
         this.nodetype = nodetype;
         this.namespace = namespace;
  
  
  
  1.8.6.4   +14 -1     
xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java
  
  Index: IncrementalSAXSource_Xerces.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/IncrementalSAXSource_Xerces.java,v
  retrieving revision 1.8.6.3
  retrieving revision 1.8.6.4
  diff -u -r1.8.6.3 -r1.8.6.4
  --- IncrementalSAXSource_Xerces.java  29 Apr 2002 16:07:40 -0000      1.8.6.3
  +++ IncrementalSAXSource_Xerces.java  1 May 2002 19:41:14 -0000       1.8.6.4
  @@ -191,6 +191,19 @@
                }
                catch(org.xml.sax.SAXNotRecognizedException e) 
{e.printStackTrace();}
                catch(org.xml.sax.SAXNotSupportedException e) 
{e.printStackTrace();}
  +
  +             // %REVIEW% Turning on schema support is necessary for some
  +             // of the information we'd like to retrieve. Unfortunately,
  +             // XERCES currently slows down by 90% (ie, takes twice as
  +             // long to run!) with this feature enabled, even if the
  +             // document never references schemas. We could make this
  +             // optional (resurrect the old -VALIDATE switch?), but it's
  +             // really not clear we want the user to have to deal with
  +             // manually setting this appropriately for every document.
  +             // The default would have to be full validation, slow mode.
  +             //
  +             // I'm trying to convince Xerces that higher speed should be
  +             // given higher priority.
                try
                {
                        
fIncrementalParser.setFeature("http://apache.org/xml/features/validation/schema",true);
  @@ -198,7 +211,7 @@
                catch(org.xml.sax.SAXNotRecognizedException e) 
{e.printStackTrace();}
                catch(org.xml.sax.SAXNotSupportedException e) 
{e.printStackTrace();}
                
  -  }
  +   }
   
     /** Create a IncrementalSAXSource_Xerces wrapped around
      * an existing SAXParser. Currently this works only for recent
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.3   +62 -57    
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XNI2DTM.java
  
  Index: XNI2DTM.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XNI2DTM.java,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- XNI2DTM.java      18 Apr 2002 20:55:11 -0000      1.2.2.2
  +++ XNI2DTM.java      1 May 2002 19:41:14 -0000       1.2.2.3
  @@ -846,71 +846,76 @@
             //String uri, String localName, String qName, Attributes 
attributes)
               throws XNIException
     {
  -     // %REVIEW% I've copied this verbatim and altered it for XNI.
  -     // Is that overkill? Can we hand any of it back to the SAX layer?
  -     // (I suspect not, darn it....)
  +    // %REVIEW% I've copied this verbatim and altered it for XNI.
  +    // Is that overkill? Can we hand any of it back to the SAX layer?
  +    // (I suspect not, darn it....)
        
  -    // Extract Experimental Xerces PSVI data         
  -    ElementPSVImpl 
elemPSVI=(ElementPSVImpl)augs.getItem(org.apache.xerces.impl.Constants.ELEMENT_PSVI);
  -    XSTypeDecl actualType =
  +    // Augs might be null if schema support not turned on in parser. 
  +    // Shouldn't arise in final operation (?); may arise during debugging
  +
  +    if(augs!=null)
  +    {
  +      // Extract Experimental Xerces PSVI data               
  +      ElementPSVImpl 
elemPSVI=(ElementPSVImpl)augs.getItem(org.apache.xerces.impl.Constants.ELEMENT_PSVI);
  +      XSTypeDecl actualType =
        (elemPSVI==null) ? null : elemPSVI.getTypeDefinition();
  -    org.apache.xerces.impl.xs.XSElementDecl expectedDecl =  // %REVIEW% 
OBSOLETE?
  +      org.apache.xerces.impl.xs.XSElementDecl expectedDecl =  // %REVIEW% 
OBSOLETE?
        (elemPSVI==null) ? null : elemPSVI.getElementDecl();
  -    XSTypeDecl expectedType = // %REVIEW% OBSOLETE?
  +      XSTypeDecl expectedType = // %REVIEW% OBSOLETE?
        (expectedDecl==null) ? actualType : expectedDecl.fType;
   
  -   if (DEBUG)
  -      {
  -      System.out.println("startElement: uri: " + element.uri + 
  -                     ", localname: " + element.localpart + 
  -                     ", qname: "+element.rawname+", atts: " + attributes);   
 
  -      String actualExpandedQName=(actualType==null) ? null : 
actualType.getTargetNamespace()+":"+actualType.getTypeName();
  +      if (DEBUG)
  +      {
  +     System.out.println("startElement: uri: " + element.uri + 
  +                        ", localname: " + element.localpart + 
  +                        ", qname: "+element.rawname+", atts: " + 
attributes);    
  +     String actualExpandedQName=(actualType==null) ? null : 
actualType.getTargetNamespace()+":"+actualType.getTypeName();
         
  -       System.out.println("\ttypeDefinition (actual): "+ actualType +
  -                     "\n\t\ttype expanded-qname: " + actualExpandedQName +
  -                     "\n\telementDecl  (expected): " + expectedDecl +
  -                     "\n\tDerived from expected (after null recovery): " + 
actualType.derivedFrom(expectedType) +
  -                     "\n\tDerived from builtin string: " + 
actualType.derivedFrom(SCHEMANS,"string")
  -                      );
  +     System.out.println("\ttypeDefinition (actual): "+ actualType +
  +                        "\n\t\ttype expanded-qname: " + actualExpandedQName +
  +                        "\n\telementDecl  (expected): " + expectedDecl +
  +                        "\n\tDerived from expected (after null recovery): " 
+ actualType.derivedFrom(expectedType) +
  +                        "\n\tDerived from builtin string: " + 
actualType.derivedFrom(SCHEMANS,"string")
  +                        );
   
  -                     boolean DEBUG_ATTRS=true;
  -                     if(DEBUG_ATTRS & attributes!=null)
  -                     {
  -                             int n = attributes.getLength();
  -                             if(n==0)
  -                                     System.out.println("\tempty attribute 
list");
  -                             else for (int i = 0; i < n; i++)
  -                             {
  -                                     System.out.println("\t attr: uri: " + 
attributes.getURI(i) +
  -                                                                             
                                 ", localname: " + attributes.getLocalName(i) +
  -                                                                             
                                 ", qname: " + attributes.getQName(i) +
  -                                                                             
                                 ", type: " + attributes.getType(i) +
  -                                                                             
                                 ", value: " + attributes.getValue(i)           
                                                                                
                 
  -                                                                             
                                 );
  -                           // Experimental Xerces PSVI data
  -                           // %REVIEW% Having some problems; Sandy Gao is 
investigating
  -                           Augmentations 
attrAugs=attributes.getAugmentations(i);
  -                               AttributePSVImpl 
attrPSVI=(AttributePSVImpl)attrAugs.getItem(org.apache.xerces.impl.Constants.ATTRIBUTE_PSVI);
  -                           actualType=(attrPSVI==null) ? null : 
attrPSVI.getTypeDefinition();
  -                           org.apache.xerces.impl.xs.XSAttributeDecl 
expectedAttrDecl= // %REVIEW% Obsolete?
  -                             (attrPSVI==null) ? null : 
attrPSVI.getAttributeDecl();                        
  -                           expectedType=(expectedAttrDecl==null) ? 
actualType : expectedAttrDecl.fType;
  -                           actualExpandedQName=(actualType==null) ? null : 
actualType.getTargetNamespace()+":"+actualType.getTypeName();
  -                               System.out.println("\t\ttypeDefinition 
(actual): "+ actualType +
  -                                             "\n\t\t\ttype expanded-qname: " 
+ actualExpandedQName +
  -                                             "\n\t\tattrDecl (expected): " + 
expectedAttrDecl
  -                                             );
  -                               if(actualType!=null)                          
                
  -                                       System.out.println("\n\t\tDerived 
from expected (after null recovery): " + actualType.derivedFrom(expectedType) +
  -                                             "\n\t\tDerived from builtin 
string: "+ actualType.derivedFrom(SCHEMANS,"string") +
  -                                             "\n\t\tTyped value: " + 
_typedValue(actualType,attributes.getValue(i))
  -                                             );
  -                             }
  -                     }
  -      }
  -             
  -    charactersFlush();
  +     boolean DEBUG_ATTRS=true;
  +     if(DEBUG_ATTRS & attributes!=null)
  +     {
  +       int n = attributes.getLength();
  +       if(n==0)
  +         System.out.println("\tempty attribute list");
  +       else for (int i = 0; i < n; i++)
  +       {
  +         System.out.println("\t attr: uri: " + attributes.getURI(i) +
  +                            ", localname: " + attributes.getLocalName(i) +
  +                            ", qname: " + attributes.getQName(i) +
  +                            ", type: " + attributes.getType(i) +
  +                            ", value: " + attributes.getValue(i)             
                                                                                
                 
  +                            );
  +         // Experimental Xerces PSVI data
  +         // %REVIEW% Having some problems; Sandy Gao is investigating
  +         Augmentations attrAugs=attributes.getAugmentations(i);
  +         AttributePSVImpl 
attrPSVI=(AttributePSVImpl)attrAugs.getItem(org.apache.xerces.impl.Constants.ATTRIBUTE_PSVI);
  +         actualType=(attrPSVI==null) ? null : attrPSVI.getTypeDefinition();
  +         org.apache.xerces.impl.xs.XSAttributeDecl expectedAttrDecl= // 
%REVIEW% Obsolete?
  +           (attrPSVI==null) ? null : attrPSVI.getAttributeDecl();            
              
  +         expectedType=(expectedAttrDecl==null) ? actualType : 
expectedAttrDecl.fType;
  +         actualExpandedQName=(actualType==null) ? null : 
actualType.getTargetNamespace()+":"+actualType.getTypeName();
  +         System.out.println("\t\ttypeDefinition (actual): "+ actualType +
  +                            "\n\t\t\ttype expanded-qname: " + 
actualExpandedQName +
  +                            "\n\t\tattrDecl (expected): " + expectedAttrDecl
  +                            );
  +         if(actualType!=null)                                                
  +           System.out.println("\n\t\tDerived from expected (after null 
recovery): " + actualType.derivedFrom(expectedType) +
  +                              "\n\t\tDerived from builtin string: "+ 
actualType.derivedFrom(SCHEMANS,"string") +
  +                              "\n\t\tTyped value: " + 
_typedValue(actualType,attributes.getValue(i))
  +                              );
  +       }
  +     }
  +      }
  +    }
       
  +    charactersFlush();
   
       int exName = m_expandedNameTable.getExpandedTypeID(element.uri, 
element.localpart, DTM.ELEMENT_NODE);
       String prefix = getPrefix(element.rawname, element.uri);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to