XdmNode.asSource
Code IndexAdd Codota to your IDE (free)

Best code snippets using net.sf.saxon.s9api.XdmNode.asSource(Showing top 9 results out of 315)

origin: apache/nifi

void writeformattedItem(XdmItem item, ProcessContext context, OutputStream out)
    throws TransformerConfigurationException, TransformerFactoryConfigurationError, TransformerException, IOException {
  if (item.isAtomicValue()) {
    out.write(item.getStringValue().getBytes(UTF8));
  } else { // item is an XdmNode
    XdmNode node = (XdmNode) item;
    switch (node.getNodeKind()) {
      case DOCUMENT:
      case ELEMENT:
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        final Properties props = getTransformerProperties(context);
        transformer.setOutputProperties(props);
        transformer.transform(node.asSource(), new StreamResult(out));
        break;
      default:
        out.write(node.getStringValue().getBytes(UTF8));
    }
  }
}
origin: com.xmlcalabash/xmlcalabash

  public void run() throws SaxonApiException {
    super.run();

    XsltCompiler compiler = runtime.getProcessor().newXsltCompiler();
    XsltExecutable exec = compiler.compile(prettyPrint.asSource());
    XsltTransformer transformer = exec.load();
    transformer.setInitialContextNode(source.read());

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    Serializer serializer = runtime.getProcessor().newSerializer();
    serializer.setOutputProperty(Serializer.Property.ENCODING, "utf-8");
    serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
    serializer.setOutputProperty(Serializer.Property.OMIT_XML_DECLARATION, "yes");
    serializer.setOutputProperty(Serializer.Property.METHOD, "xml");

    serializer.setOutputStream(stream);
    transformer.setDestination(serializer);
    transformer.transform();

    XdmNode output = runtime.parse(new InputSource(new ByteArrayInputStream(stream.toByteArray())));
    result.write(output);
  }
}
origin: com.xmlcalabash/xmlcalabash

protected String serialize(XdmNode doc, MediaType type) {
  XProcRuntime runtime = getGlobalRuntime();
  String format = "text";
  if (MediaType.TEXT_HTML.equals(type)) {
    format = "html";
  } else if (MediaType.APPLICATION_XML.equals(type)) {
    format = "xml";
  } else if (MediaType.APPLICATION_JSON.equals(type)) {
    format = "json";
  }
  if (xsl() != null) {
    XdmDestination result = null;
    try {
      XsltCompiler compiler = runtime.getProcessor().newXsltCompiler();
      XsltExecutable exec = compiler.compile(xsl().asSource());
      XsltTransformer transformer = exec.load();
      transformer.setParameter(_format, new XdmAtomicValue(format));
      transformer.setInitialContextNode(doc);
      result = new XdmDestination();
      transformer.setDestination(result);
      transformer.transform();
    } catch (SaxonApiException e) {
      throw new XProcException(e);
    }
    doc = result.getXdmNode();
  }
  return doc.toString();
}
origin: com.xmlcalabash/xmlcalabash

return cache.get(uri).asSource();
origin: net.sf.saxon/Saxon-HE

Source style = compiler.getAssociatedStylesheet(sourceDoc.asSource(), null, null, null);
XsltExecutable sheet = compiler.compile(style);
origin: com.xmlcalabash/xmlcalabash

exec = compiler.compile(compiledSchema.asSource());
transformer = exec.load();
for (QName name : params.keySet()) {
origin: com.xmlcalabash/xmlcalabash

    "Validating: " + doc.getBaseURI().toASCIIString()));
validator.validate(doc.asSource());
if (validationException != null) {
  throw (SaxonApiException) validationException;
origin: net.sf.saxon/Saxon-HE

source = node.asSource();
origin: com.xmlcalabash/xmlcalabash

XsltCompiler compiler = runtime.getProcessor().newXsltCompiler();
compiler.setSchemaAware(processor.isSchemaAware());
XsltExecutable exec = compiler.compile(stylesheet.asSource());
XsltTransformer transformer = exec.load();
net.sf.saxon.s9apiXdmNodeasSource

Javadoc

Get a JAXP Source object corresponding to this node, allowing the node to be used as input to transformations or queries.

The Source object that is returned will generally be one that is acceptable to Saxon interfaces that expect an instance of javax.xml.transform.Source. However, there is no guarantee that it will be recognized by other products.

In fact, the current implementation always returns an instance of net.sf.saxon.om.NodeInfo.

Popular methods of XdmNode

  • getNodeKind
    Get the kind of node.
  • getStringValue
  • getUnderlyingNode
    Get the underlying Saxon implementation object representing this node. This provides access to class
  • <init>
    Construct an XdmNode as a wrapper around an existing NodeInfo object
  • axisIterator
    Get an iterator over the nodes reachable from this node via a given axis, selecting only those nodes
  • getLineNumber
    Get the line number of the node in a source document. For a document constructed using the document
  • getNodeName
    Get the name of the node, as a QName
  • getUnderlyingValue
  • toString
    The toString() method returns a simple XML serialization of the node with defaulted serialization pa
  • getAttributeValue
    Get the string value of a named attribute of this element
  • getBaseURI
    Get the base URI of this node
  • getColumnNumber
    Get the column number of the node in a source document. For a document constructed using the documen
  • getBaseURI,
  • getColumnNumber,
  • getDocumentURI,
  • getParent,
  • wrapItem

Popular classes and methods

  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedImage (java.awt.image)
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Collectors (java.util.stream)
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JButton (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)