public void selectEnd()

in java/src/org/apache/qetest/xalanj2/LoggingTraceListenerEx.java [111:188]


    public void selectEnd(EndSelectionEvent endSelectionEvent) 
          throws javax.xml.transform.TransformerException
    {
        counters[TYPE_SELECTED_END]++;
        Hashtable attrs = new Hashtable();
        attrs.put("event", "selectEnd");
        attrs.put("location", "L" + endSelectionEvent.m_styleNode.getLineNumber()
                  + "C" + endSelectionEvent.m_styleNode.getColumnNumber());

        StringBuffer buf = new StringBuffer("  <styleNode>");
        ElemTemplateElement styleNodeElem = (ElemTemplateElement) endSelectionEvent.m_styleNode;
        ElemTemplateElement parent = (ElemTemplateElement) styleNodeElem.getParentNode();
        if (parent == styleNodeElem.getStylesheetRoot().getDefaultRootRule())
        {
            buf.append("[default-root-rule]");
        }
        else if (parent == styleNodeElem.getStylesheetRoot().getDefaultTextRule())
        {
            buf.append("[default-text-rule]");
        }
        else if (parent == styleNodeElem.getStylesheetRoot().getDefaultRule())
        {
            buf.append("[default-rule]");
        }
        else
            buf.append(XalanDumper.dump(styleNodeElem, XalanDumper.DUMP_DEFAULT));
            
        buf.append("  </styleNode>\n");

        buf.append("  <m_xpath>" + endSelectionEvent.m_attributeName + "="
                   + endSelectionEvent.m_xpath.getPatternString() + "</m_xpath>\n");

        buf.append("  <m_selection>");
        if (endSelectionEvent.m_selection.getType() == endSelectionEvent.m_selection.CLASS_NODESET)
        {
            NodeIterator nl = endSelectionEvent.m_selection.nodeset();

            if (nl instanceof ContextNodeList)
            {
                try
                {
                    nl = ((ContextNodeList)nl).cloneWithReset();
                }
                catch(CloneNotSupportedException cnse)
                {
                    buf.append("[Can't trace nodelist, threw: CloneNotSupportedException]");
                }
                Node pos = nl.nextNode();

                if (null == pos)
                {
                    buf.append("[empty node list]");
                }
                else // (null == pos)
                {
                    while (null != pos)
                    {
                        buf.append(" " + pos);
                        pos = nl.nextNode();
                    }
                }
            }
            else // (nl instanceof ContextNodeList)
            {
                buf.append("[Can't trace nodelist: it isn't a ContextNodeList]");
            }
        }
        else // (selectionEvent.m_selection.getType() == selectionEvent.m_selection.CLASS_NODESET)
        {
            buf.append("[" + endSelectionEvent.m_selection.str() +"]");
        }
        buf.append("</m_selection>\n");

        buf.append("  <m_sourceNode>" + XalanDumper.dump(endSelectionEvent.m_sourceNode, XalanDumper.DUMP_DEFAULT) + "</m_sourceNode>\n");

        setLastItem(buf.toString());
        logger.logElement(level, TRACE_LISTENER_DUMP, attrs, buf.toString());
    }