private String getShortSystemId(NodeInfo node) { String systemId=node.getSystemId(); if(format==Format.VERBOSE) { int ind=systemId.lastIndexOf('/'); if(ind>0) systemId=systemId.substring(ind+1); } else { Integer value=namePool.get(systemId); if(value==null) { value=namePool.size(); namePool.put(systemId, value); } systemId=value.toString(); } return systemId; }
public String getSystemId() { NodeInfo info=context.getContextNodeInfo(); return info.getSystemId(); }
public static String getLocation(Context context) { StringBuilder sb = new StringBuilder(); StaticContext staticContext = context.getStaticContext(); if(staticContext != null) { String systemId = staticContext.getSystemId(); if(systemId != null && systemId.length() > 0) { sb.append(systemId).append(":").append(staticContext.getLineNumber()); } } NodeInfo current = context.getCurrentNodeInfo(); if(current != null) { String systemId = current.getSystemId(); if(systemId != null && systemId.length() > 0) { if(sb.length() > 0) { sb.append("|"); } sb.append(systemId).append(":").append(current.getLineNumber()); } } return sb.toString(); }
@Override public void enter(NodeInfo node, Context arg1) { XSLTraceStep step = new XSLTraceStep(); step.start = System.nanoTime(); step.startInsNo = instructionCount; step.systemId = node.getSystemId(); step.lineNumber = node.getLineNumber(); step.displayName = node.getDisplayName(); if(currentStep != null) { step.parent = currentStep; if(currentStep.children == null) { currentStep.children = new ArrayList<>(); } currentStep.children.add(step); } currentStep = step; instructionCount++; }
public void fatalError(TransformerException e) throws TransformerException { if(traceListener != null) { NodeInfo nodeInfo = traceListener.getContextNodeInfo(); nodeInfo = traceListener.getCurrentNodeInfo(); if(nodeInfo != null && nodeInfo.getSystemId() != null && !nodeInfo.getSystemId().isEmpty()) { XMLSourceLocator xmlLocator = new XMLSourceLocator(nodeInfo.getSystemId(), nodeInfo.getLineNumber()); XSLSourceLocator xslLocator = new XSLSourceLocator(e.getLocator(), xmlLocator); e.setLocator(xslLocator); } } super.fatalError(e); }
public static String getLocation(Context context) { StringBuilder sb = new StringBuilder(); NodeInfo currentNode = context.getCurrentNodeInfo(); if(currentNode != null) { sb.append(currentNode.getSystemId() + ":" + currentNode.getParent().getParent().getLineNumber()); } StaticContext staticContext = context.getStaticContext(); sb.append(" "+staticContext.getSystemId()+ ":"+staticContext.getLineNumber()); return sb.toString(); }