minchau     2003/06/09 13:15:18

  Modified:    java/src/org/apache/xml/serializer ToHTMLStream.java
                        ToStream.java ToTextStream.java
  Log:
  Changing firePseudoAttributes() to firePseudoElement() which
  is for debugger tooling.  Now both the whole start of the element-tag
  e.g.   <abc attr1="val1" attr2="val2"
  will appear as output that might be written out, rather than
  just the attributes.
  
  Submitted by: Gordon Chiu
  Reviewed by:  Brian Minchau
  
  Revision  Changes    Path
  1.13      +7 -0      
xml-xalan/java/src/org/apache/xml/serializer/ToHTMLStream.java
  
  Index: ToHTMLStream.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToHTMLStream.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ToHTMLStream.java 3 Jun 2003 22:27:26 -0000       1.12
  +++ ToHTMLStream.java 9 Jun 2003 20:15:17 -0000       1.13
  @@ -787,6 +787,9 @@
                   // not update all the other state information because the 
endElement() is
                   // coming right away.  If you want to kill this optimization 
the corresponding
                   // optimization "OPTIMIZE-EMPTY in endElement() must be 
killed too.
  +                if (m_tracer != null)
  +                    firePseudoElement(name);
  +
                   return;
               }
   
  @@ -796,6 +799,10 @@
               m_elementName = name;
               m_isRawStack.push(elemDesc.is(ElemDesc.RAW));
               m_currentElemDepth++; // current element is one element deeper
  +
  +            if (m_tracer != null)
  +                firePseudoElement(name);
  +
               
               if (elemDesc.is(ElemDesc.HEADELEM))
               {
  
  
  
  1.10      +13 -7     
xml-xalan/java/src/org/apache/xml/serializer/ToStream.java
  
  Index: ToStream.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToStream.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ToStream.java     9 Jun 2003 06:32:11 -0000       1.9
  +++ ToStream.java     9 Jun 2003 20:15:17 -0000       1.10
  @@ -1767,6 +1767,9 @@
           m_startTagOpen = true;
           m_currentElemDepth++; // current element is one element deeper
           m_isprevtext = false;
  +        
  +             if (m_tracer != null)
  +                     firePseudoElement(name);
       }
   
       /**
  @@ -2740,7 +2743,7 @@
                */
               m_attributes.setValue(index, value);
               if (old_value != null)
  -                firePseudoAttributes();
  +                firePseudoElement(m_elementName);
   
           }
           else
  @@ -2748,27 +2751,30 @@
               // the attribute doesn't exist yet, create it
               m_attributes.addAttribute(uri, localName, rawName, type, value);
               if (m_tracer != null)
  -                firePseudoAttributes();
  +                firePseudoElement(m_elementName);
           }
   
       }
   
       /**
  -     * To fire off the pseudo characters of attributes, as they currently
  +     * To fire off the pseudo characters of elements, as they currently
        * exist. This method should be called everytime an attribute is added,
  -     * or when an attribute value is changed.
  +     * or when an attribute value is changed, or an element is created.
        */
   
  -    protected void firePseudoAttributes()
  +    protected void firePseudoElement(String elementName)
       {
   
  -        int nAttrs;
  +        int nAttrs = m_attributes.getLength();
   
  -        if (m_tracer != null && (nAttrs = m_attributes.getLength()) > 0)
  +        if (m_tracer != null)
           {
               String encoding = getEncoding();
               // make a StringBuffer to write the name="value" pairs to.
               StringBuffer sb = new StringBuffer();
  +            
  +            sb.append('<');
  +            sb.append(elementName);
   
               // make a writer that internally appends to the same
               // StringBuffer
  
  
  
  1.4       +6 -2      
xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java
  
  Index: ToTextStream.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ToTextStream.java 30 May 2003 07:08:43 -0000      1.3
  +++ ToTextStream.java 9 Jun 2003 20:15:18 -0000       1.4
  @@ -162,8 +162,10 @@
       m_currentElemDepth++;
   
       // time to fire off startElement event
  -    if (m_tracer != null)
  +    if (m_tracer != null) {
           super.fireStartElem(name);
  +        this.firePseudoElement(name);
  +    }
       return;
     }
   
  @@ -583,8 +585,10 @@
           if (m_needToCallStartDocument)
               startDocumentInternal();         
                // time to fire off startlement event.
  -        if (m_tracer != null)
  +        if (m_tracer != null) {
               super.fireStartElem(elementName);
  +            this.firePseudoElement(elementName);
  +        }
           
           return;
       }
  
  
  

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

Reply via email to