pipe.setComponent(CopyInformee.class.getName(), copier);
pipe.setComponent(CopyInformee.class.getName(), copier);
public Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException { NodeInfo xml = (NodeInfo) arguments[0].head(); if (xml == null) { return EmptySequence.getInstance(); } boolean indent = false; if (getArity() > 1) { MapItem suppliedOptions = (MapItem) arguments[1].head(); Map<String, Sequence<?>> options = getDetails().optionDetails.processSuppliedOptions(suppliedOptions, context); indent = ((BooleanValue)options.get("indent").head()).getBooleanValue(); } PipelineConfiguration pipe = context.getController().makePipelineConfiguration(); pipe.setXPathContext(context); JsonReceiver receiver = new JsonReceiver(pipe); receiver.setIndenting(indent); Receiver r = receiver; if (xml.getNodeKind() == Type.DOCUMENT) { r = new DocumentValidator(r, "FOJS0006"); } StartTagBuffer stb = new StartTagBuffer(r); pipe.setComponent(StartTagBuffer.class.getName(), stb); stb.setPipelineConfiguration(pipe); stb.open(); xml.copy(stb, 0, ExplicitLocation.UNKNOWN_LOCATION); stb.close(); return new StringValue(receiver.getJsonString()); }
public Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException { NodeInfo xml = (NodeInfo) arguments[0].head(); if (xml == null) { return EmptySequence.getInstance(); } boolean indent = false; if (getArity() > 1) { MapItem suppliedOptions = (MapItem) arguments[1].head(); Map<String, Sequence<?>> options = getDetails().optionDetails.processSuppliedOptions(suppliedOptions, context); indent = ((BooleanValue)options.get("indent").head()).getBooleanValue(); } PipelineConfiguration pipe = context.getController().makePipelineConfiguration(); pipe.setXPathContext(context); JsonReceiver receiver = new JsonReceiver(pipe); receiver.setIndenting(indent); Receiver r = receiver; if (xml.getNodeKind() == Type.DOCUMENT) { r = new DocumentValidator(r, "FOJS0006"); } StartTagBuffer stb = new StartTagBuffer(r); pipe.setComponent(StartTagBuffer.class.getName(), stb); stb.setPipelineConfiguration(pipe); stb.open(); xml.copy(stb, 0, ExplicitLocation.UNKNOWN_LOCATION); stb.close(); return new StringValue(receiver.getJsonString()); }
savedPipe = new PipelineConfiguration(pipe); LocationCopier copier = new LocationCopier(false); pipe.setComponent(CopyInformee.class.getName(), copier); savedPipe = new PipelineConfiguration(val.getPipelineConfiguration()); LocationCopier copier = new LocationCopier(true); val.getPipelineConfiguration().setComponent(CopyInformee.class.getName(), copier);
savedPipe = new PipelineConfiguration(pipe); LocationCopier copier = new LocationCopier(false); pipe.setComponent(CopyInformee.class.getName(), copier); savedPipe = new PipelineConfiguration(val.getPipelineConfiguration()); LocationCopier copier = new LocationCopier(true); val.getPipelineConfiguration().setComponent(CopyInformee.class.getName(), copier);