jkesselm    2002/08/16 11:35:27

  Modified:    java/src/org/apache/xml/dtm/ref/xni2dtm Tag: xslt20
                        XNI2DTM.java XPath2Type.java
  Log:
  Partial fix for ACCESSORS003
  
  Better handling of data() -- not all nodes have data() values. (Since we
  haven't defined Error, I'm returning Empty for now.)
  
  Still not getting quite the right value for non-schematyped Elements.
  Investigating why not.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.4.1.2.1 +21 -4     
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.4.1
  retrieving revision 1.2.4.1.2.1
  diff -u -r1.2.4.1 -r1.2.4.1.2.1
  --- XNI2DTM.java      14 Aug 2002 19:45:35 -0000      1.2.4.1
  +++ XNI2DTM.java      16 Aug 2002 18:35:27 -0000      1.2.4.1.2.1
  @@ -332,9 +332,9 @@
       return false;
     }
     
  -  /** ADDED FOR XPATH2: Retrieve the typed value(s), based on the schema type
  -   * 
  -   * %REVIEW% That may not be 
  +  /** ADDED FOR XPATH2: Retrieve the typed value(s), based on the schema 
type.
  +   * This is "the error value" for non-nodes, document, namespace, comment 
or 
  +   * processing instruction nodes.
      * */
     public DTMSequence getTypedValue(int nodeHandle)
     {
  @@ -347,13 +347,27 @@
       int identity=makeNodeIdentity(nodeHandle);
       if(identity==DTM.NULL)
         return DTMSequence.EMPTY;
  +      
  +    int nodetype=_type(identity);
  +    if(nodetype==DTM.DOCUMENT_NODE 
  +     || nodetype==DTM.NAMESPACE_NODE
  +     || nodetype==DTM.COMMENT_NODE
  +     || nodetype==DTM.PROCESSING_INSTRUCTION_NODE)
  +      return DTMSequence.EMPTY;
                   
       XPath2Type 
actualType=(XPath2Type)m_schemaTypeOverride.elementAt(identity);
       if(actualType==null)
         
actualType=(XPath2Type)m_expandedNameTable.getSchemaType(m_exptype.elementAt(identity));
   
  +     // No schema type. Return as any.
       if(actualType==null)
  -      return DTMSequence.EMPTY;
  +    {
  +     return new DTM_XSequence(getStringValue(nodeHandle).toString(),
  +             (nodetype!=this.ELEMENT_NODE) 
  +                     ?  XPath2Type.XSANYSIMPLETYPE
  +                     : XPath2Type.XSANYTYPE );
  +    }
  +
                   
           /* %REVIEW% Efficiency issues; value may be in FSB or scattered,
                 in which case generating a Java String may arguably be 
wasteful. 
  @@ -363,6 +377,9 @@
           //GONK efficiency;
           
       // Gathers all text. Is that right? Should we not do if type is not 
known?
  +    //
  +    // %OPT% toString is needed because getStringValue returns an XString...
  +    // might be good to have a lower-level string accessor.
       String textvalue=getStringValue(nodeHandle).toString();
       
       // DTM node should provide the namespace context.
  
  
  
  1.1.2.1.2.1 +24 -1     
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XPath2Type.java
  
  Index: XPath2Type.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XPath2Type.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.1.2.1
  diff -u -r1.1.2.1 -r1.1.2.1.2.1
  --- XPath2Type.java   14 Aug 2002 19:45:35 -0000      1.1.2.1
  +++ XPath2Type.java   16 Aug 2002 18:35:27 -0000      1.1.2.1.2.1
  @@ -81,6 +81,24 @@
      * */
   public class XPath2Type
   {
  +     /** Manefest constant: dtm.getTypedValue() wants to be able to return
  +      * untyped values. Rather than trying to dig it out of the schema 
context, 
  +      * it's easier to have one ready for use... */
  +     public static final XPath2Type XSSTRING=
  +             new 
XPath2Type(null,"http://www.w3.org/2001/XMLSchema","string";);       
  +     /** Manefest constant: dtm.getTypedValue() wants to be able to return
  +      * untyped values as strings, and needs a suitable type object. Rather
  +      * than trying to dig it out of the schema context, it's easier to
  +      * have one ready for use... */
  +     public static final XPath2Type XSANYTYPE=
  +             new 
XPath2Type(null,"http://www.w3.org/2001/XMLSchema","anyType";);      
  +     /** Manefest constant: dtm.getTypedValue() wants to be able to return
  +      * untyped values as strings, and needs a suitable type object. Rather
  +      * than trying to dig it out of the schema context, it's easier to
  +      * have one ready for use... */
  +     public static final XPath2Type XSANYSIMPLETYPE=
  +             new 
XPath2Type(null,"http://www.w3.org/2001/XMLSchema","anySimpleType";);        
  +     
        public XSTypeDefinition m_xniType;
        public String m_namespace;
        public String m_localName;
  @@ -201,8 +219,13 @@
     {
       Object value;
       DTM_XSequence seq=null;
  +    
  +    if(m_xniType==null)
  +    {
  +      seq=new DTM_XSequence(textvalue,this);
  +    }
   
  -    if(m_xniType instanceof XSSimpleTypeDefinition)
  +    else if(m_xniType instanceof XSSimpleTypeDefinition)
       {           
         //create an instance of 'ValidatedInfo' to get back information 
         //(like actual value, normalizedValue etc..)after content is validated.
  
  
  

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

Reply via email to