jkesselm    2002/06/04 12:21:27

  Modified:    java/src/org/apache/xml/dtm/ref/xni2dtm Tag: Xalan3
                        DTM2XNI.java FuncValidate.java XNI2DTM.java
  Log:
  Better support for "lightweight" PSVI, prep for heavyweight
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +6 -4      
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/DTM2XNI.java
  
  Index: DTM2XNI.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/DTM2XNI.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- DTM2XNI.java      31 May 2002 20:50:50 -0000      1.1.2.1
  +++ DTM2XNI.java      4 Jun 2002 19:21:27 -0000       1.1.2.2
  @@ -385,8 +385,10 @@
         org.apache.xerces.xni.XMLAttributes attrs = 
                               new org.apache.xerces.util.XMLAttributesImpl();
   
  -      for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != 
nsn;
  -           nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
  +       // Note that this needs to scan the namespaces declared ON THIS NODE,
  +       // *not* the ones inherited.
  +      for (int nsn = m_dtm.getFirstNamespaceNode(node, false); DTM.NULL != 
nsn;
  +           nsn = m_dtm.getNextNamespaceNode(node, nsn, false))
         {
           String nsprefix = m_dtm.getLocalName(nsn); //xmlns:whatever
                
  @@ -522,8 +524,8 @@
                                m_dtm.getNodeName(node),ns);
         m_XMLDocumentHandler.endElement(qq,null);
   
  -      for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != 
nsn;
  -           nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
  +      for (int nsn = m_dtm.getFirstNamespaceNode(node, false); DTM.NULL != 
nsn;
  +           nsn = m_dtm.getNextNamespaceNode(node, nsn, false))
         {
           // String prefix = m_dtm.getPrefix(nsn);
           String prefix = m_dtm.getNodeNameX(nsn);
  
  
  
  1.1.2.2   +11 -3     
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/FuncValidate.java
  
  Index: FuncValidate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/FuncValidate.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- FuncValidate.java 31 May 2002 20:50:50 -0000      1.1.2.1
  +++ FuncValidate.java 4 Jun 2002 19:21:27 -0000       1.1.2.2
  @@ -30,11 +30,19 @@
                DTM sourceDTM=proxy.getDTM();
                int sourceHandle=proxy.getDTMNodeNumber();
                DTMManager dtmmgr=((DTMDefaultBase)sourceDTM).getManager();
  -             
  +
  +             // Set up an XNI scanner to read from the source DTM,
  +             // run that through validation (operates as a filter?),
  +             // and pass that into Xalan to produce a new document
  +             // %REVIEW% system ID???
                DTM2XNI d2x=new DTM2XNI(sourceDTM,sourceHandle);
  +             
  +             // VALIDATION GOES HERE!
  +             // Sandy Gao recommends "create a customized parser 
configuration,
  +             // which contains an XNI event source, a validator, and 
(optionally)
  +             // a document handler." See "pipelines" in the XNI docs.
  +             
                XNISource xsrc=new XNISource(d2x,null);
  -             // %REVIEW% system ID???
  -                     
                DTM newDTM=dtmmgr.getDTM(xsrc,
                        true, // unique
                        null, // whitespace filter
  
  
  
  1.2.2.9   +18 -9     
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.8
  retrieving revision 1.2.2.9
  diff -u -r1.2.2.8 -r1.2.2.9
  --- XNI2DTM.java      1 Jun 2002 00:24:16 -0000       1.2.2.8
  +++ XNI2DTM.java      4 Jun 2002 19:21:27 -0000       1.2.2.9
  @@ -104,9 +104,8 @@
    * 
    * Please note that it this is a PROTOTYPE, since the Xerces post-schema 
    * validation infoset (PSVI) APIs it is using are themselves prototypes and
  - * subject to change without warning. Also note that currently Xerces only
  - * implements a subset of the "light weight" PSVI, whereas the official
  - * XPath2 data model requires the heavyweight version. 
  + * subject to change without warning. The most recent such change was from
  + * "lightweight" to "heavyweight" schema models.
    * 
    * This version is derived from SAX2DTM for ease of implementation and
    * support, but deliberately blocks external access to
  @@ -1783,6 +1782,10 @@
         * */
        public boolean equals(XPath2Type other)
        {
  +             // Could cache hashCode()'s result and use that to accelerate
  +             // doesn't-equal testing at the cost of some storage and
  +             // slowing down does-equal tests. Not convinced it's useful 
here.
  +             // %REVIEW%
                return (m_xniType==other.m_xniType ||
                        m_xniType!=null && m_xniType.equals(other.m_xniType)) &&
                        // These two won't be null
  @@ -1795,6 +1798,8 @@
         * */
        public int hashCode()
        {
  +             // Could cache hashCode(). See discussion in equals().
  +             // %REVIEW%
                return m_namespace.hashCode()+m_localName.hashCode()+
                        (m_xniType==null ? 0 : m_xniType.hashCode());
        }
  @@ -1888,7 +1893,8 @@
      * */  
     protected void heavyResolveTypeName(ItemPSVI psvi, boolean attr)
     {
  -  /*
  +     /* Not compatable with old light-weight schema APIs
  +
        // NAME OF THIS CONSTANT IS IN FLUX
        //int VALID=ItemPSVI.VALIDITY_VALID;
        int VALID=ItemPSVI.VALID_VALIDITY;
  @@ -1926,7 +1932,7 @@
           m_namespace = "http://www.w3.org/2001/XMLSchema";;
           m_localName = attr ? "anySimpleType" : "anyType";
           return;
  -  */ throw new java.lang.UnsupportedOperationException("Xerces Heavyweight 
not yet available");
  +  */ throw new java.lang.UnsupportedOperationException("Xerces Heavyweight 
PSVI not yet avaialble"); /**/       
     }
     
     /** Modification of the XPath2 type-name resolution algorithm
  @@ -1943,7 +1949,8 @@
      * */  
     protected void proposedHeavyResolveTypeName(ItemPSVI psvi, boolean attr)
     {
  -  /*
  +     /* Not compatable with old light-weight schema APIs
  +
        // NAME OF THIS CONSTANT IS IN FLUX
        //int VALID=ItemPSVI.VALIDITY_VALID;
        int VALID=ItemPSVI.VALID_VALIDITY;
  @@ -1980,7 +1987,7 @@
           m_namespace = "http://www.w3.org/2001/XMLSchema";;
           m_localName = attr ? "anySimpleType" : "anyType";
           return;
  -  */ throw new java.lang.UnsupportedOperationException("Xerces Heavyweight 
not yet available");
  +  */ throw new java.lang.UnsupportedOperationException("Xerces Heavyweight 
PSVI not yet avaialble"); /**/       
     }
     
     /** Attempt to write a simplified version of the type resolution
  @@ -1999,8 +2006,9 @@
      * */  
     protected void lightResolveTypeName(ItemPSVI psvi, boolean attr)
     {
  -     // NAME OF THIS CONSTANT IS IN FLUX
  -     //int VALID=ItemPSVI.VALIDITY_VALID;
  +     /* Not compatable with new heavy-weight schema APIs
  +     */
  +     
        int VALID=ItemPSVI.VALID_VALIDITY;
        
           // check whether the node is valid
  @@ -2033,6 +2041,7 @@
           m_namespace = "http://www.w3.org/2001/XMLSchema";;
           m_localName = attr ? "anySimpleType" : "anyType";
           return;
  +  // throw new java.lang.UnsupportedOperationException("Xerces Lightweight 
PSVI phased out"); /**/
     }
     } // XPath2Type
   } // XNI2DTM
  
  
  

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

Reply via email to