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

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

本文整理了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

  1. public Result resolve(String href, String base) throws TransformerException {
  2. URI baseURI = null;
  3. try {
  4. baseURI = new URI(base);
  5. baseURI = baseURI.resolve(href);
  6. } catch (URISyntaxException use) {
  7. throw new XProcException(use);
  8. }
  9. logger.trace(MessageFormatter.nodeMessage(step.getNode(), "XSLT secondary result document: " + baseURI));
  10. try {
  11. XdmDestination xdmResult = new XdmDestination();
  12. secondaryResults.put(baseURI.toASCIIString(), xdmResult);
  13. Receiver receiver = xdmResult.getReceiver(runtime.getProcessor().getUnderlyingConfiguration());
  14. return new FixedSysidReceiver(receiver, baseURI.toASCIIString());
  15. } catch (SaxonApiException sae) {
  16. throw new XProcException(sae);
  17. }
  18. }

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

  1. public Result resolve(String href, String base) throws TransformerException {
  2. URI baseURI = null;
  3. try {
  4. baseURI = new URI(base);
  5. baseURI = baseURI.resolve(href);
  6. } catch (URISyntaxException use) {
  7. throw new XProcException(use);
  8. }
  9. logger.trace(MessageFormatter.nodeMessage(step.getNode(), "XSLT secondary result document: " + baseURI));
  10. try {
  11. XdmDestination xdmResult = new XdmDestination();
  12. secondaryResults.put(baseURI.toASCIIString(), xdmResult);
  13. Receiver receiver = xdmResult.getReceiver(runtime.getProcessor().getUnderlyingConfiguration());
  14. return new FixedSysidReceiver(receiver, baseURI.toASCIIString());
  15. } catch (SaxonApiException sae) {
  16. throw new XProcException(sae);
  17. }
  18. }

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

  1. @Override
  2. public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException {
  3. URI absolute = getAbsoluteUri(href, baseUri);
  4. XdmDestination destination = new XdmDestination();
  5. destination.setDestinationBaseURI(absolute);
  6. destination.onClose(() -> {
  7. XdmNode root = destination.getXdmNode();
  8. results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo());
  9. });
  10. return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties);
  11. }

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

  1. @Override
  2. public Receiver resolve(XPathContext context, String href, String baseUri, SerializationProperties properties) throws XPathException {
  3. URI absolute = getAbsoluteUri(href, baseUri);
  4. XdmDestination destination = new XdmDestination();
  5. destination.setDestinationBaseURI(absolute);
  6. destination.onClose(() -> {
  7. XdmNode root = destination.getXdmNode();
  8. results.put(absolute.toASCIIString(), root.getUnderlyingValue().getTreeInfo());
  9. });
  10. return destination.getReceiver(context.getReceiver().getPipelineConfiguration(), properties);
  11. }

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

  1. public static XMLStreamWritable<XdmNode> nodeWriter(Configuration configuration) throws SaxonApiException, XPathException {
  2. XdmDestination destination = new XdmDestination();
  3. Receiver receiver = new NamespaceReducer(destination.getReceiver(configuration));
  4. receiver.open();
  5. BaseURIAwareXMLStreamWriter writer = new BaseURIAwareStreamWriterToReceiver(receiver);
  6. return new XMLStreamWritable<XdmNode>() {
  7. public BaseURIAwareXMLStreamWriter getWriter() {
  8. return writer;
  9. }
  10. public XdmNode doneWriting() throws TransformerException {
  11. try {
  12. receiver.close();
  13. return destination.getXdmNode();
  14. } catch (XPathException e) {
  15. throw new TransformerException(e);
  16. }
  17. }
  18. };
  19. }

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

  1. @Override
  2. public Result resolve(String href, String base) throws TransformerException {
  3. try {
  4. XdmDestination dest = new XdmDestination();
  5. URI uri = new URI("lux:/").resolve(href);
  6. dest.setBaseURI(uri);
  7. Configuration config = getCompiler().getProcessor().getUnderlyingConfiguration();
  8. Receiver receiver = dest.getReceiver(config);
  9. receiver.setSystemId(href);
  10. XdmDestinationProxy xdmDestinationProxy = new XdmDestinationProxy(receiver, dest);
  11. xdmDestinationProxy.setSystemId(href);
  12. return xdmDestinationProxy;
  13. } catch (SaxonApiException e) {
  14. throw new TransformerException(e);
  15. } catch (URISyntaxException e) {
  16. throw new TransformerException(e);
  17. }
  18. }

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

  1. public void startDocument(URI baseURI) {
  2. inDocument = true;
  3. seenRoot = false;
  4. try {
  5. exec = new Executable(controller.getConfiguration());
  6. destination = new XdmDestination();
  7. receiver = destination.getReceiver(controller.getConfiguration());
  8. PipelineConfiguration pipe = controller.makePipelineConfiguration();
  9. receiver.setPipelineConfiguration(pipe);
  10. if (baseURI != null) {
  11. receiver.setSystemId(baseURI.toASCIIString());
  12. } else {
  13. receiver.setSystemId("http://example.com/");
  14. }
  15. receiver.open();
  16. receiver.startDocument(0);
  17. } catch (Exception e) {
  18. throw new XProcException(e);
  19. }
  20. }

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

  1. public void startDocument(URI baseURI) {
  2. inDocument = true;
  3. seenRoot = false;
  4. try {
  5. exec = new Executable(controller.getConfiguration());
  6. destination = new XdmDestination();
  7. receiver = destination.getReceiver(controller.getConfiguration());
  8. PipelineConfiguration pipe = controller.makePipelineConfiguration();
  9. receiver.setPipelineConfiguration(pipe);
  10. if (baseURI != null) {
  11. receiver.setSystemId(baseURI.toASCIIString());
  12. } else {
  13. receiver.setSystemId("http://example.com/");
  14. }
  15. receiver.open();
  16. receiver.startDocument(0);
  17. } catch (Exception e) {
  18. throw new XProcException(e);
  19. }
  20. }

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

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

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

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

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

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

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

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

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

  1. public void run() throws SaxonApiException {
  2. Processor processor = new Processor(true);
  3. SchemaManager manager = processor.getSchemaManager();
  4. // No resolver here, there isn't one.
  5. DocumentBuilder builder = processor.newDocumentBuilder();
  6. SAXSource source = new SAXSource(new InputSource("http://tests.xproc.org/tests/doc/compoundEntity.xml"));
  7. XdmNode document = builder.build(source);
  8. source = new SAXSource(new InputSource("http://tests.xproc.org/tests/doc/document.xsd"));
  9. XdmNode schema = builder.build(source);
  10. manager.load(schema.asSource());
  11. XdmDestination destination = new XdmDestination();
  12. Controller controller = new Controller(processor.getUnderlyingConfiguration());
  13. Receiver receiver = destination.getReceiver(controller.getConfiguration());
  14. PipelineConfiguration pipe = controller.makePipelineConfiguration();
  15. pipe.setRecoverFromValidationErrors(false);
  16. receiver.setPipelineConfiguration(pipe);
  17. SchemaValidator validator = manager.newSchemaValidator();
  18. validator.setDestination(destination);
  19. dumpTree(document, "Input");
  20. validator.validate(document.asSource());
  21. XdmNode valid = destination.getXdmNode();
  22. dumpTree(valid, "Output");
  23. }

相关文章