public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.simPos"); presenter.emitAttribute("test", nodeTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } presenter.emitAttribute("pos", position + ""); presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.simPos"); presenter.emitAttribute("test", nodeTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } presenter.emitAttribute("pos", position + ""); presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.nodeTest"); presenter.emitAttribute("test", nodeTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; try { presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.nodeTest"); presenter.emitAttribute("test", nodeTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; try { presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.genPos"); presenter.emitAttribute("type", nodeTest.toString()); if (!usesPosition) { // flag is this way around for backwards compatibility with 9.8 presenter.emitAttribute("flags", "P"); } if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { try { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } positionExpr.export(presenter); presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.genPos"); presenter.emitAttribute("type", nodeTest.toString()); if (!usesPosition) { // flag is this way around for backwards compatibility with 9.8 presenter.emitAttribute("flags", "P"); } if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { try { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", nodeTest.generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } positionExpr.export(presenter); presenter.endElement(); }
@Override public void export(ExpressionPresenter out) throws XPathException { ExpressionPresenter.ExportOptions options = (ExpressionPresenter.ExportOptions) out.getOptions(); out.startElement("origF"); out.emitAttribute("name", getFunctionName()); out.emitAttribute("arity", ""+getArity()); out.emitAttribute("pack", options.packageMap.get(component.getContainingPackage())+""); out.endElement(); } }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter destination) throws XPathException { destination.startElement("axis", this); destination.emitAttribute("name", AxisInfo.axisName[axis]); destination.emitAttribute("nodeTest", test == null ? "node()" : test.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) destination.getOptions()).target)) { NodeTest known = AnyNodeTest.getInstance(); if (axis == AxisInfo.ATTRIBUTE) { known = NodeKindTest.makeNodeKindTest(Type.ATTRIBUTE); } else if (axis == AxisInfo.NAMESPACE) { known = NodeKindTest.makeNodeKindTest(Type.NAMESPACE); } int targetVersion = ((ExpressionPresenter.ExportOptions) destination.getOptions()).targetVersion; try { destination.emitAttribute("jsTest", test == null ? "return true;" : test.generateJavaScriptItemTypeTest(known, targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } destination.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("treat", this); out.emitAttribute("as", requiredItemType.toExportString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", requiredItemType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } out.emitAttribute("diag", role.save()); getBaseExpression().export(out); out.endElement(); }
@Override public void export(ExpressionPresenter out) throws XPathException { ExpressionPresenter.ExportOptions options = (ExpressionPresenter.ExportOptions) out.getOptions(); out.startElement("origF"); out.emitAttribute("name", getFunctionName()); out.emitAttribute("arity", ""+getArity()); out.emitAttribute("pack", options.packageMap.get(component.getContainingPackage())+""); out.endElement(); } }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * * @param out the expression presenter used to display the structure */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("try", this); if (rollbackOutput) { out.emitAttribute("flags", "r"); } tryOp.getChildExpression().export(out); for (CatchClause clause : catchClauses) { out.startElement("catch"); out.emitAttribute("err", clause.nameTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("test", clause.nameTest.generateJavaScriptNameTest(targetVersion)); } clause.catchOp.getChildExpression().export(out); out.endElement(); } out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("instance", this); if (targetCardinality == StaticProperty.ALLOWS_ZERO) { out.emitAttribute("of", "empty-sequence()"); } else { out.emitAttribute("of", targetType.toExportString() + Cardinality.getOccurrenceIndicator(targetCardinality)); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", targetType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } getBaseExpression().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * * @param out the expression presenter used to display the structure */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("try", this); if (rollbackOutput) { out.emitAttribute("flags", "r"); } tryOp.getChildExpression().export(out); for (CatchClause clause : catchClauses) { out.startElement("catch"); out.emitAttribute("err", clause.nameTest.toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("test", clause.nameTest.generateJavaScriptNameTest(targetVersion)); } clause.catchOp.getChildExpression().export(out); out.endElement(); } out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("instance", this); if (targetCardinality == StaticProperty.ALLOWS_ZERO) { out.emitAttribute("of", "empty-sequence()"); } else { out.emitAttribute("of", targetType.toExportString() + Cardinality.getOccurrenceIndicator(targetCardinality)); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", targetType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); } getBaseExpression().export(out); out.endElement(); }
/** * Export the global context item declaration to an SEF export file * @param out the export destination * @throws XPathException if things go wrong */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("glob"); String use; if (isMayBeOmitted()) { if (isAbsentFocus()) { use = "pro"; } else { use = "opt"; } } else { use = "req"; } out.emitAttribute("use", use); if (!getRequiredItemType().equals(AnyItemType.getInstance())) { out.emitAttribute("type", getRequiredItemType().toExportString()); } if ("JS".equals(((ExpressionPresenter.ExportOptions) out.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) out.getOptions()).targetVersion; out.emitAttribute("jsTest", getRequiredItemType().generateJavaScriptItemTypeTest( AnyItemType.getInstance(), targetVersion)); } out.endElement(); }
public void explainProperties(ExpressionPresenter presenter) throws XPathException { if (getRequiredContextItemType() != AnyItemType.getInstance()) { presenter.emitAttribute("cxt", getRequiredContextItemType().toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", getRequiredContextItemType().generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } } String flags = ""; if (!absentFocus) { flags += "s"; } presenter.emitAttribute("flags", flags); if (getRequiredType() != SequenceType.ANY_SEQUENCE) { presenter.emitAttribute("as", getRequiredType().toExportString()); } presenter.emitAttribute("line", getLineNumber() + ""); presenter.emitAttribute("module", getSystemId()); if (isDeclaredStreamable()) { presenter.emitAttribute("streamable", "1"); } }
public void explainProperties(ExpressionPresenter presenter) throws XPathException { if (getRequiredContextItemType() != AnyItemType.getInstance()) { presenter.emitAttribute("cxt", getRequiredContextItemType().toString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", getRequiredContextItemType().generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } } String flags = ""; if (!absentFocus) { flags += "s"; } presenter.emitAttribute("flags", flags); if (getRequiredType() != SequenceType.ANY_SEQUENCE) { presenter.emitAttribute("as", getRequiredType().toExportString()); } presenter.emitAttribute("line", getLineNumber() + ""); presenter.emitAttribute("module", getSystemId()); if (isDeclaredStreamable()) { presenter.emitAttribute("streamable", "1"); } }
public void explainProperties(ExpressionPresenter presenter) throws XPathException { if (getRequiredContextItemType() != AnyItemType.getInstance()) { presenter.emitAttribute("cxt", getRequiredContextItemType().toExportString()); if ("JS".equals(((ExpressionPresenter.ExportOptions) presenter.getOptions()).target)) { try { int targetVersion = ((ExpressionPresenter.ExportOptions) presenter.getOptions()).targetVersion; presenter.emitAttribute("jsTest", getRequiredContextItemType().generateJavaScriptItemTypeTest(AnyItemType.getInstance(), targetVersion)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); throw e; } } } String flags = ""; if (mayOmitContextItem) { flags = "o"; } if (!absentFocus) { flags += "s"; } presenter.emitAttribute("flags", flags); if (getRequiredType() != SequenceType.ANY_SEQUENCE) { presenter.emitAttribute("as", getRequiredType().toExportString()); } presenter.emitAttribute("line", getLineNumber() + ""); presenter.emitAttribute("module", getSystemId()); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("treat", this); out.emitAttribute("as", requiredItemType.toExportString()); ExpressionPresenter.ExportOptions options = (ExpressionPresenter.ExportOptions) out.getOptions(); if ("JS".equals(options.target)) { int targetVersion = options.targetVersion; out.emitAttribute("jsTest", requiredItemType.generateJavaScriptItemTypeTest(getBaseExpression().getItemType(), targetVersion)); if (targetVersion == 2) { SequenceType st = SequenceType.makeSequenceType(requiredItemType, StaticProperty.EXACTLY_ONE); out.emitAttribute("asJ", st.toExportString2()); } } out.emitAttribute("diag", role.save()); getBaseExpression().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement("let", this); out.emitAttribute("var", variableName); out.emitAttribute("as", getSequence().getStaticType().toExportString()); ExpressionPresenter.ExportOptions options = (ExpressionPresenter.ExportOptions) out.getOptions(); if (options.target.equals("JS") && options.targetVersion == 2) { out.emitAttribute("asJ", getSequence().getStaticType().toExportString2()); } if (isIndexedVariable()) { out.emitAttribute("indexable", "true"); } out.emitAttribute("slot", getLocalSlotNumber() + ""); if (evaluator == null) { setEvaluator(ExpressionTool.lazyEvaluator(getSequence(), getNominalReferenceCount() > 1)); } out.emitAttribute("eval", getEvaluator().getCode() + ""); getSequence().export(out); getAction().export(out); out.endElement(); }