copy method

XPathConfiguration copy({
  1. Map<String, Object?>? variables,
  2. Map<XmlName, XPathFunctionItem>? functions,
  3. String? namespaceUri,
  4. Map<String, String>? namespaceUris,
  5. Map<String, XmlNode>? documents,
  6. Map<String, List<XmlNode>>? collections,
  7. Map<String, String>? environment,
  8. String? baseUri,
  9. XPathUnparsedTextLoader? unparsedTextLoader,
  10. XPathTraceCallback? onTraceCallback,
})

Creates a modified copy of the static context.

Implementation

XPathConfiguration copy({
  Map<String, Object?>? variables,
  Map<XmlName, XPathFunctionItem>? functions,
  String? namespaceUri,
  Map<String, String>? namespaceUris,
  Map<String, XmlNode>? documents,
  Map<String, List<XmlNode>>? collections,
  Map<String, String>? environment,
  String? baseUri,
  XPathUnparsedTextLoader? unparsedTextLoader,
  XPathTraceCallback? onTraceCallback,
}) {
  final convertedVariables = variables == null
      ? null
      : {
          for (final entry in variables.entries)
            entry.key: XPathSequence.fromObject(entry.value),
        };
  return XPathConfiguration.raw(
    variables: this.variables.extend(convertedVariables),
    functions: this.functions.extend(functions),
    namespaceUri: namespaceUri ?? this.namespaceUri,
    namespaceUris: this.namespaceUris.extend(namespaceUris),
    documents: this.documents.extend(documents),
    collections: this.collections.extend(collections),
    environment: this.environment.extend(environment),
    baseUri: baseUri ?? this.baseUri,
    unparsedTextLoader: unparsedTextLoader ?? this.unparsedTextLoader,
    onTraceCallback: onTraceCallback ?? this.onTraceCallback,
  );
}