Search in sources :

Example 46 with DTMIterator

use of org.apache.xml.dtm.DTMIterator in project intellij-community by JetBrains.

the class XalanTraceListener method trace.

@Override
public void trace(TracerEvent ev) {
    if (myTracing)
        return;
    // prevents handling of recursive trace() events
    myTracing = true;
    try {
        // init
        if (firstTrace) {
            firstTrace = false;
            final SerializationHandler handler = myTransformer.getSerializationHandler();
            myTransformer.setSerializationHandler(new TracingSerializationHandler(myDebugger, handler));
        }
        super.trace(ev);
        final DTMIterator iterator = myTransformer.getContextNodeList();
        final int node = myTransformer.getMatchedNode();
        final Debugger.SourceFrame sourceFrame = myDebugger.getSourceFrame();
        final boolean withSource;
        if (sourceFrame == null || ((MySourceFrame) sourceFrame).getMatchedNode() != node) {
            myDebugger.pushSource(new MySourceFrame(sourceFrame, iterator.getDTM(node), node));
            withSource = true;
        } else {
            withSource = false;
        }
        myDebugger.enter(new XalanStyleFrame(ev, myDebugger.getCurrentFrame(), withSource));
    } finally {
        myTracing = false;
    }
}
Also used : Debugger(org.intellij.plugins.xsltDebugger.rt.engine.Debugger) LocalDebugger(org.intellij.plugins.xsltDebugger.rt.engine.local.LocalDebugger) SerializationHandler(org.apache.xml.serializer.SerializationHandler) DTMIterator(org.apache.xml.dtm.DTMIterator)

Aggregations

DTMIterator (org.apache.xml.dtm.DTMIterator)46 DTM (org.apache.xml.dtm.DTM)23 XPathContext (org.apache.xpath.XPathContext)12 XObject (org.apache.xpath.objects.XObject)12 TransformerException (javax.xml.transform.TransformerException)11 XMLString (org.apache.xml.utils.XMLString)10 XNumber (org.apache.xpath.objects.XNumber)10 XNodeSet (org.apache.xpath.objects.XNodeSet)8 Vector (java.util.Vector)6 QName (org.apache.xml.utils.QName)6 SAXException (org.xml.sax.SAXException)6 SerializationHandler (org.apache.xml.serializer.SerializationHandler)5 Hashtable (java.util.Hashtable)4 IntStack (org.apache.xml.utils.IntStack)4 NodeSetDTM (org.apache.xpath.NodeSetDTM)4 SubContextList (org.apache.xpath.axes.SubContextList)4 IOException (java.io.IOException)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 ElemTemplateElement (org.apache.xalan.templates.ElemTemplateElement)2 KeyDeclaration (org.apache.xalan.templates.KeyDeclaration)2