/** * Get the target environment for which we are optimizing * @return the target environment (for example "EE" or "JS"). Defaults to the edition * of the current configuration */ public String getTargetEdition() { return staticContext.getPackageData().getTargetEdition(); }
/** * Get the target environment for which we are optimizing * @return the target environment (for example "EE" or "JS"). Defaults to the edition * of the current configuration */ public String getTargetEdition() { return staticContext.getPackageData().getTargetEdition(); }
private void checkAllowedType(StaticContext env, BuiltInAtomicType type) throws XPathException { String s = whyDisallowedType(env.getPackageData(), type); if (s != null) { grumble(s, "XPST0080"); } }
private void checkAllowedType(StaticContext env, BuiltInAtomicType type) throws XPathException { String s = whyDisallowedType(env.getPackageData(), type); if (s != null) { grumble(s, "XPST0080"); } }
public RetainedStaticContext(StaticContext sc) { this.config = sc.getConfiguration(); this.packageData = sc.getPackageData(); if (sc.getStaticBaseURI() != null) { staticBaseUriString = sc.getStaticBaseURI(); try { this.staticBaseUri = ExpressionTool.getBaseURI(sc, null, true); } catch (XPathException e) { staticBaseUri = null; } } this.defaultCollationName = sc.getDefaultCollationName(); this.decimalFormatManager = sc.getDecimalFormatManager(); this.defaultElementNamespace = sc.getDefaultElementNamespace(); defaultFunctionNamespace = sc.getDefaultFunctionNamespace(); backwardsCompatibility = sc.isInBackwardsCompatibleMode(); if (Version.platform.JAXPStaticContextCheck(this, sc)) { //updated in method } else { this.namespaces = new HashMap<>(4); NamespaceResolver resolver = sc.getNamespaceResolver(); for (Iterator<String> it = resolver.iteratePrefixes(); it.hasNext(); ) { String prefix = it.next(); if (!prefix.equals("xml")) { namespaces.put(prefix, resolver.getURIForPrefix(prefix, true)); } } } }
/** * Set location information on a clause of a FLWOR expression. This version of the method supplies an * explicit offset (character position within the expression or query), which the tokenizer * can convert to a line number and column number. * * @param clause the clause whose location information is to be set * @param offset the character position within the expression (ignoring newlines) */ public void setLocation(Clause clause, int offset) { int line = t.getLineNumber(offset); int column = t.getColumnNumber(offset); Location loc = makeNestedLocation(env.getContainingLocation(), line, column, null); clause.setLocation(loc); clause.setPackageData(env.getPackageData()); }
public RetainedStaticContext(StaticContext sc) { this.config = sc.getConfiguration(); this.packageData = sc.getPackageData(); if (sc.getStaticBaseURI() != null) { staticBaseUriString = sc.getStaticBaseURI(); try { this.staticBaseUri = ExpressionTool.getBaseURI(sc, null, true); } catch (XPathException e) { staticBaseUri = null; } } this.defaultCollationName = sc.getDefaultCollationName(); this.decimalFormatManager = sc.getDecimalFormatManager(); this.defaultElementNamespace = sc.getDefaultElementNamespace(); defaultFunctionNamespace = sc.getDefaultFunctionNamespace(); backwardsCompatibility = sc.isInBackwardsCompatibleMode(); if (Version.platform.JAXPStaticContextCheck(this, sc)) { //updated in method } else { this.namespaces = new HashMap<>(4); NamespaceResolver resolver = sc.getNamespaceResolver(); for (Iterator<String> it = resolver.iteratePrefixes(); it.hasNext(); ) { String prefix = it.next(); if (!prefix.equals("xml")) { namespaces.put(prefix, resolver.getURIForPrefix(prefix, true)); } } } }
/** * Set location information on a clause of a FLWOR expression. This version of the method supplies an * explicit offset (character position within the expression or query), which the tokenizer * can convert to a line number and column number. * * @param clause the clause whose location information is to be set * @param offset the character position within the expression (ignoring newlines) */ public void setLocation(Clause clause, int offset) { int line = t.getLineNumber(offset); int column = t.getColumnNumber(offset); Location loc = makeNestedLocation(env.getContainingLocation(), line, column, null); clause.setLocation(loc); clause.setPackageData(env.getPackageData()); }
protected void ensureSchemaAware(String featureName) throws XPathException { if (!env.getConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY)) { throw new XPathException("This Saxon version and license does not allow use of '" + featureName + "'", "XQST0009"); } env.getConfiguration().checkLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY, featureName, -1); getExecutable().setSchemaAware(true); getStaticContext().getPackageData().setSchemaAware(true); }
protected void ensureSchemaAware(String featureName) throws XPathException { if (!env.getConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY)) { throw new XPathException("This Saxon version and license does not allow use of '" + featureName + "'", "XQST0009"); } env.getConfiguration().checkLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY, featureName, -1); getExecutable().setSchemaAware(true); getStaticContext().getPackageData().setSchemaAware(true); }
untyped = untyped | !visitor.getStaticContext().getPackageData().isSchemaAware();
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { optimizeChildren(visitor, contextItemType); if (!Literal.isEmptySequence(getContentExpression())) { if (getContentExpression() instanceof Block) { setContentExpression(((Block) getContentExpression()).mergeAdjacentTextInstructions()); } // This code removed 25 Aug 2016. We no longer introduce copy operations. But we could go // further, and try to get rid of more unnecessary copy operations (whether streaming or not...) // Reinstated 14 Oct 2016 if (visitor.isOptimizeForStreaming()) { visitor.obtainOptimizer().makeCopyOperationsExplicit(this, contentOp); } } if (visitor.getStaticContext().getPackageData().isSchemaAware()) { TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); if (getValidationAction() == Validation.STRIP) { if (getContentExpression().hasSpecialProperty(StaticProperty.ALL_NODES_UNTYPED) || th.relationship(getContentExpression().getItemType(), MultipleNodeKindTest.DOC_ELEM_ATTR) == TypeHierarchy.DISJOINT) { // No need to strip type annotations if there are none needing to be stripped setNoNeedToStrip(); } } } else { setNoNeedToStrip(); } return this; }
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { optimizeChildren(visitor, contextItemType); if (!Literal.isEmptySequence(getContentExpression())) { if (getContentExpression() instanceof Block) { setContentExpression(((Block) getContentExpression()).mergeAdjacentTextInstructions()); } // This code removed 25 Aug 2016. We no longer introduce copy operations. But we could go // further, and try to get rid of more unnecessary copy operations (whether streaming or not...) // Reinstated 14 Oct 2016 if (visitor.isOptimizeForStreaming()) { visitor.obtainOptimizer().makeCopyOperationsExplicit(this, contentOp); } } if (visitor.getStaticContext().getPackageData().isSchemaAware()) { TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); if (getValidationAction() == Validation.STRIP) { if (getContentExpression().hasSpecialProperty(StaticProperty.ALL_NODES_UNTYPED) || th.relationship(getContentExpression().getItemType(), MultipleNodeKindTest.DOC_ELEM_ATTR) == TypeHierarchy.DISJOINT) { // No need to strip type annotations if there are none needing to be stripped setNoNeedToStrip(); } } } else { setNoNeedToStrip(); } return this; }
untyped = untyped | !visitor.getStaticContext().getPackageData().isSchemaAware();
int offset = t.currentTokenStartOffset; GlobalVariable var = new GlobalVariable(); var.setPackageData(env.getPackageData()); var.setLineNumber(t.getLineNumber() + 1); var.setSystemId(env.getSystemId()); if ("external".equals(t.currentTokenValue)) { GlobalParam par = new GlobalParam(); par.setPackageData(env.getPackageData());
int offset = t.currentTokenStartOffset; GlobalVariable var = new GlobalVariable(); var.setPackageData(env.getPackageData()); var.setLineNumber(t.getLineNumber() + 1); var.setSystemId(env.getSystemId()); if ("external".equals(t.currentTokenValue)) { GlobalParam par = new GlobalParam(); par.setPackageData(env.getPackageData());
if (env.getPackageData().isSchemaAware() && elementTest instanceof SchemaNodeTest && outermostElementNames.get().size() == 1) { if (!env.getPackageData().isSchemaAware()) { SchemaType ct = test.getContentType(); if (!(ct == AnyType.getInstance() || ct == Untyped.getInstance() || ct == AnySimpleType.getInstance() ||
if (env.getPackageData().isSchemaAware() && elementTest instanceof SchemaNodeTest && outermostElementNames.get().size() == 1) { if (!env.getPackageData().isSchemaAware()) { SchemaType ct = test.getContentType(); if (!(ct == AnyType.getInstance() || ct == Untyped.getInstance() || ct == AnySimpleType.getInstance() ||