sboag       01/06/12 22:54:38

  Modified:    java/src/org/apache/xml/dtm/ref/dom2dtm DOM2DTM.java
  Log:
  Sort-of kind-of handle DOM1 by checking if getLocalName returns
  null for elements or attributes, and, if it does, use getNodeName.
  
  Joe, I guess we should think about some DOM1 compatibility.
  (It's actually not DOM1, but addElement vs. addElementNS, I think).
  
  This is needed to make stylebook run.
  (Joe, we must of been drunk when we thought we had fixed it, or,
  more likely, I somehow picked up a different version of the jar?)
  
  Revision  Changes    Path
  1.3       +20 -14    xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
  
  Index: DOM2DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOM2DTM.java      2001/06/12 19:15:52     1.2
  +++ DOM2DTM.java      2001/06/13 05:54:38     1.3
  @@ -177,9 +177,9 @@
       
       int type;
       if(NULL==forceNodeType)
  -     type = node.getNodeType();
  +        type = node.getNodeType();
       else
  -     type=forceNodeType;
  +        type=forceNodeType;
       
       m_nodes.addElement(node);
       
  @@ -238,6 +238,12 @@
       String localName =  (type == Node.PROCESSING_INSTRUCTION_NODE) ? 
                            node.getNodeName() :
                            node.getLocalName();
  +                         
  +    // Hack to make DOM1 sort of work...
  +    if(((type == Node.ELEMENT_NODE) || (type == Node.ATTRIBUTE_NODE)) 
  +        && null == localName)
  +      localName = node.getNodeName(); // -sb
  +      
       ExpandedNameTable exnt = m_expandedNameTable;
   
       // %TBD% Nodes created with the old non-namespace-aware DOM
  @@ -1094,7 +1100,7 @@
         return node.getNodeValue();
       
       FastStringBuffer buf = StringBufferPool.get();
  -     buf.append(node.getNodeValue());
  +        buf.append(node.getNodeValue());
       while(n!=null)
       {
         buf.append(n.getNodeValue());
  @@ -1466,15 +1472,15 @@
         int type = getNodeType(nodeHandle);
         Node node = getNode(nodeHandle);
         dispatchNodeData(node, ch, 0);
  -       // Text coalition -- a DTM text node may represent multiple
  -       // DOM nodes.
  -       if(TEXT_NODE == type || CDATA_SECTION_NODE == type)
  -       {
  -               while( null != (node=logicalNextDOMTextNode(node)) )
  -               {
  -                   dispatchNodeData(node, ch, 0);
  -               }
  -       }
  +          // Text coalition -- a DTM text node may represent multiple
  +          // DOM nodes.
  +          if(TEXT_NODE == type || CDATA_SECTION_NODE == type)
  +          {
  +                  while( null != (node=logicalNextDOMTextNode(node)) )
  +                  {
  +                      dispatchNodeData(node, ch, 0);
  +                  }
  +          }
       }
     }
     
  @@ -1523,8 +1529,8 @@
       case Node.COMMENT_NODE :
         if(0 != depth)
           break;
  -     // NOTE: Because this operation works in the DOM space, it does _not_ attempt
  -     // to perform Text Coalition. That should only be done in DTM space. 
  +        // NOTE: Because this operation works in the DOM space, it does _not_ 
attempt
  +        // to perform Text Coalition. That should only be done in DTM space. 
       case Node.TEXT_NODE :
       case Node.CDATA_SECTION_NODE :
       case Node.ATTRIBUTE_NODE :
  
  
  

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

Reply via email to