net.sf.saxon.s9api.XdmDestination.getReceiver()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中net.sf.saxon.s9api.XdmDestination.getReceiver()方法的一些代码示例,展示了XdmDestination.getReceiver()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XdmDestination.getReceiver()方法的具体详情如下:
包路径:net.sf.saxon.s9api.XdmDestination
类名称:XdmDestination
方法名:getReceiver

XdmDestination.getReceiver介绍

[英]Return a Receiver. Saxon calls this method to obtain a Receiver, to which it then sends a sequence of events representing the content of an XML document.
[中]传回一个听筒。Saxon调用此方法以获取接收器,然后向其发送一系列表示XML文档内容的事件。

代码示例

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

public Result resolve(String href, String base) throws TransformerException {
  URI baseURI = null;
  try {
    baseURI = new URI(base);
    baseURI = baseURI.resolve(href);
  } catch (URISyntaxException use) {
    throw new XProcException(use);
  }
  logger.trace(MessageFormatter.nodeMessage(step.getNode(), "XSLT secondary result document: " + baseURI));
  try {
    XdmDestination xdmResult = new XdmDestination();
    secondaryResults.put(baseURI.toASCIIString(), xdmResult);
    Receiver receiver = xdmResult.getReceiver(runtime.getProcessor().getUnderlyingConfiguration());
    return new FixedSysidReceiver(receiver, baseURI.toASCIIString());
  } catch (SaxonApiException sae) {
    throw new XProcException(sae);
  }
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

public Result resolve(String href, String base) throws TransformerException {
  URI baseURI = null;
  try {
    baseURI = new URI(base);
    baseURI = baseURI.resolve(href);
  } catch (URISyntaxException use) {
    throw new XProcException(use);
  }
  logger.trace(MessageFormatter.nodeMessage(step.getNode(), "XSLT secondary result document: " + baseURI));
  try {
    XdmDestination xdmResult = new XdmDestination();
    secondaryResults.put(baseURI.toASCIIString(), xdmResult);
    Receiver receiver = xdmResult.getReceiver(runtime.getProcessor().getUnderlyingConfiguration());
    return new FixedSysidReceiver(receiver, baseURI.toASCIIString());
  } catch (SaxonApiException sae) {
    throw new XProcException(sae);
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

@Override
public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException {
  URI absolute = getAbsoluteUri(href, baseUri);
  XdmDestination destination = new XdmDestination();
  destination.setDestinationBaseURI(absolute);
  destination.onClose(() -> {
    XdmNode root = destination.getXdmNode();
    results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo());
  });
  return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

@Override
public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException {
  URI absolute = getAbsoluteUri(href, baseUri);
  XdmDestination destination = new XdmDestination();
  destination.setDestinationBaseURI(absolute);
  destination.onClose(() -> {
    XdmNode root = destination.getXdmNode();
    results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo());
  });
  return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties);
}

代码示例来源:origin: org.daisy.pipeline/common-utils

public static XMLStreamWritable<XdmNode> nodeWriter(Configuration configuration) throws SaxonApiException, XPathException {
  XdmDestination destination = new XdmDestination();
  Receiver receiver = new NamespaceReducer(destination.getReceiver(configuration));
  receiver.open();
  BaseURIAwareXMLStreamWriter writer = new BaseURIAwareStreamWriterToReceiver(receiver);
  return new XMLStreamWritable<XdmNode>() {
    public BaseURIAwareXMLStreamWriter getWriter() {
      return writer;
    }
    public XdmNode doneWriting() throws TransformerException {
      try {
        receiver.close();
        return destination.getXdmNode();
      } catch (XPathException e) {
        throw new TransformerException(e);
      }
    }
  };
}

代码示例来源:origin: msokolov/lux

@Override
public Result resolve(String href, String base) throws TransformerException {
  try {
    XdmDestination dest = new XdmDestination();
    URI uri = new URI("lux:/").resolve(href);
    dest.setBaseURI(uri);
    Configuration config = getCompiler().getProcessor().getUnderlyingConfiguration();
    Receiver receiver = dest.getReceiver(config);
    receiver.setSystemId(href);
    XdmDestinationProxy xdmDestinationProxy = new XdmDestinationProxy(receiver, dest);
    xdmDestinationProxy.setSystemId(href);
    return xdmDestinationProxy;
  } catch (SaxonApiException e) {
    throw new TransformerException(e);
  } catch (URISyntaxException e) {
    throw new TransformerException(e);
  }
}

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

public void startDocument(URI baseURI) {
  inDocument = true;
  seenRoot = false;
  try {
    exec = new Executable(controller.getConfiguration());
    destination = new XdmDestination();
    receiver = destination.getReceiver(controller.getConfiguration());
    PipelineConfiguration pipe = controller.makePipelineConfiguration();
    receiver.setPipelineConfiguration(pipe);
    if (baseURI != null) {
      receiver.setSystemId(baseURI.toASCIIString());
    } else {
      receiver.setSystemId("http://example.com/");
    }
    receiver.open();
    receiver.startDocument(0);
  } catch (Exception e) {
    throw new XProcException(e);
  }
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

public void startDocument(URI baseURI) {
  inDocument = true;
  seenRoot = false;
  try {
    exec = new Executable(controller.getConfiguration());
    destination = new XdmDestination();
    receiver = destination.getReceiver(controller.getConfiguration());
    PipelineConfiguration pipe = controller.makePipelineConfiguration();
    receiver.setPipelineConfiguration(pipe);
    if (baseURI != null) {
      receiver.setSystemId(baseURI.toASCIIString());
    } else {
      receiver.setSystemId("http://example.com/");
    }
    receiver.open();
    receiver.startDocument(0);
  } catch (Exception e) {
    throw new XProcException(e);
  }
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

Receiver receiver = destination.getReceiver(controller.getConfiguration());
PipelineConfiguration pipe = controller.makePipelineConfiguration();
pipe.setRecoverFromValidationErrors(!getOption(_assert_valid,false));

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

Receiver receiver = destination.getReceiver(controller.getConfiguration());
PipelineConfiguration pipe = controller.makePipelineConfiguration();
pipe.setRecoverFromValidationErrors(!getOption(_assert_valid,false));

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

receiver = destination.getReceiver(saxonConfig);
PipelineConfiguration pipe = controller.makePipelineConfiguration();

代码示例来源:origin: com.xmlcalabash/xmlcalabash

receiver = destination.getReceiver(saxonConfig);
PipelineConfiguration pipe = controller.makePipelineConfiguration();

代码示例来源:origin: ndw/xmlcalabash1

public void run() throws SaxonApiException {
  Processor processor = new Processor(true);
  SchemaManager manager = processor.getSchemaManager();
  // No resolver here, there isn't one.
  DocumentBuilder builder = processor.newDocumentBuilder();
  SAXSource source = new SAXSource(new InputSource("http://tests.xproc.org/tests/doc/compoundEntity.xml"));
  XdmNode document = builder.build(source);
  source = new SAXSource(new InputSource("http://tests.xproc.org/tests/doc/document.xsd"));
  XdmNode schema = builder.build(source);
  manager.load(schema.asSource());
  XdmDestination destination = new XdmDestination();
  Controller controller = new Controller(processor.getUnderlyingConfiguration());
  Receiver receiver = destination.getReceiver(controller.getConfiguration());
  PipelineConfiguration pipe = controller.makePipelineConfiguration();
  pipe.setRecoverFromValidationErrors(false);
  receiver.setPipelineConfiguration(pipe);
  SchemaValidator validator = manager.newSchemaValidator();
  validator.setDestination(destination);
  dumpTree(document, "Input");
  validator.validate(document.asSource());
  XdmNode valid = destination.getXdmNode();
  dumpTree(valid, "Output");
}

相关文章