public ProcessMatch(XProcRuntime runtime, ProcessMatchingNodes processor) { super(runtime); this.runtime = runtime; this.processor = processor; saxonConfig = runtime.getProcessor().getUnderlyingConfiguration(); }
CssSplitTransformer(RuntimeValue splitBefore, RuntimeValue splitAfter, XProcRuntime runtime) { this.config = runtime.getProcessor().getUnderlyingConfiguration(); this.splitBefore = splitBefore; this.splitAfter = splitAfter; }
public ProcessMatch(XProcRuntime runtime, ProcessMatchingNodes processor) { super(runtime); this.runtime = runtime; this.processor = processor; saxonConfig = runtime.getProcessor().getUnderlyingConfiguration(); }
public static XdmNode removeNamespaces(XProcRuntime runtime, XdmNode node, HashSet<String> excludeNS, boolean preserveUsed) { return removeNamespaces(runtime.getProcessor(), node, excludeNS, preserveUsed); }
public TreeWriter(XProcRuntime xproc) { runtime = xproc; pool = xproc.getProcessor().getUnderlyingConfiguration().getNamePool(); controller = new Controller(runtime.getProcessor().getUnderlyingConfiguration()); }
public static InputSource xdmToInputSource(XProcRuntime runtime, XdmNode node) throws SaxonApiException { ByteArrayOutputStream out = new ByteArrayOutputStream(); Serializer serializer = runtime.getProcessor().newSerializer(); serializer.setOutputStream(out); serialize(runtime, node, serializer); InputSource isource = new InputSource(new ByteArrayInputStream(out.toByteArray())); if (node.getBaseURI() != null) { isource.setSystemId(node.getBaseURI().toASCIIString()); } return isource; }
public static InputSource xdmToInputSource(XProcRuntime runtime, XdmNode node) throws SaxonApiException { ByteArrayOutputStream out = new ByteArrayOutputStream(); Serializer serializer = runtime.getProcessor().newSerializer(); serializer.setOutputStream(out); serialize(runtime, node, serializer); InputSource isource = new InputSource(new ByteArrayInputStream(out.toByteArray())); if (node.getBaseURI() != null) { isource.setSystemId(node.getBaseURI().toASCIIString()); } return isource; }
public TreeWriter(XProcRuntime xproc) { runtime = xproc; pool = xproc.getProcessor().getUnderlyingConfiguration().getNamePool(); controller = new Controller(runtime.getProcessor().getUnderlyingConfiguration()); }
private XdmNode parse(InputStream instream, URI baseURI) throws SaxonApiException { try { XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setEntityResolver(runtime.getResolver()); SAXSource source = new SAXSource(reader, new InputSource(instream)); DocumentBuilder builder = runtime.getProcessor().newDocumentBuilder(); builder.setLineNumbering(true); builder.setDTDValidation(false); builder.setBaseURI(baseURI); return builder.build(source); } catch (SAXException se) { throw new XProcException(se); } }
public static void transform(DOMToXMLStreamTransformer transformer, ReadablePipe input, WritablePipe output, XProcRuntime runtime) throws TransformerException { writePipe(output, SaxonHelper.transform(transformer, Iterators.transform(readPipe(input), XdmNode::getUnderlyingNode), runtime.getProcessor().getUnderlyingConfiguration())); }
public static void transform(XMLStreamToXMLStreamTransformer transformer, ReadablePipe input, WritablePipe output, XProcRuntime runtime) throws TransformerException { writePipe(output, SaxonHelper.transform(transformer, Iterators.transform(readPipe(input), XdmNode::getUnderlyingNode), runtime.getProcessor().getUnderlyingConfiguration())); }
private XdmNode parseHTML(String text) { HtmlDocumentBuilder htmlBuilder = new HtmlDocumentBuilder(XmlViolationPolicy.ALTER_INFOSET); htmlBuilder.setEntityResolver(runtime.getResolver()); try { InputSource src = new InputSource(new StringReader(text)); Document html = htmlBuilder.parse(src); DocumentBuilder builder = runtime.getProcessor().newDocumentBuilder(); XdmNode doc = builder.build(new DOMSource(html)); return doc; } catch (Exception e) { throw new XProcException(e); } } }
public void run() throws SaxonApiException { super.run(); Processor proc = runtime.getProcessor(); SchemaManager manager = proc.getSchemaManager(); if (manager == null) { validateWithXerces(); } else { validateWithSaxonSA(manager); } }
public static void transform(NodeToXMLStreamTransformer transformer, ReadablePipe input, WritablePipe output, XProcRuntime runtime) throws TransformerException { writePipe(output, SaxonHelper.transform(transformer, readPipe(input), runtime.getProcessor().getUnderlyingConfiguration())); }
public void run() throws SaxonApiException { super.run(); Processor proc = runtime.getProcessor(); if (proc.isSchemaAware()) { SchemaManager manager = proc.getSchemaManager(); validateWithSaxonSA(manager); } else { validateWithXerces(); } }
public XdmAtomicValue getUntypedAtomic(XProcRuntime runtime) { try { ItemTypeFactory itf = new ItemTypeFactory(runtime.getProcessor()); ItemType untypedAtomic = itf.getAtomicType(new QName(NamespaceConstant.SCHEMA, "xs:untypedAtomic")); XdmAtomicValue val = new XdmAtomicValue(value, untypedAtomic); return val; } catch (SaxonApiException sae) { throw new XProcException(sae); } }
public void run() throws SaxonApiException { Processor proc = runtime.getProcessor(); AnnotationsConfigExtension annoExt = new AnnotationsConfigExtension(proc); new ConfigReader(proc, mConfig.read(), annoExt); for (XdmNode annotations : annoExt.getAnnotations(mContentType)) { mResult.write(annotations); } }
public XdmAtomicValue getUntypedAtomic(XProcRuntime runtime) { try { ItemTypeFactory itf = new ItemTypeFactory(runtime.getProcessor()); ItemType untypedAtomic = itf.getAtomicType(new QName(NamespaceConstant.SCHEMA, "xs:untypedAtomic")); XdmAtomicValue val = new XdmAtomicValue(value, untypedAtomic); return val; } catch (SaxonApiException sae) { throw new XProcException(sae); } }
private XdmNode transform(XdmNode source, SAXSource stylesheet) throws SaxonApiException { XsltCompiler compiler = runtime.getProcessor().newXsltCompiler(); compiler.setSchemaAware(schemaAware); compiler.setURIResolver(new UResolver()); XsltExecutable exec = compiler.compile(stylesheet); XsltTransformer schemaCompiler = exec.load(); schemaCompiler.setInitialContextNode(source); XdmDestination result = new XdmDestination(); schemaCompiler.setDestination(result); schemaCompiler.transform(); return result.getXdmNode(); }
private XdmNode transform(XdmNode source, SAXSource stylesheet) throws SaxonApiException { XsltCompiler compiler = runtime.getProcessor().newXsltCompiler(); compiler.setSchemaAware(schemaAware); compiler.setURIResolver(new UResolver()); XsltExecutable exec = compiler.compile(stylesheet); XsltTransformer schemaCompiler = exec.load(); schemaCompiler.setInitialContextNode(source); XdmDestination result = new XdmDestination(); schemaCompiler.setDestination(result); schemaCompiler.transform(); return result.getXdmNode(); }