public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { logger.trace("ResolveEntity(" + publicId + "," + systemId + ")"); if (systemId == null) { return null; } try { URI baseURI = new URI(systemId); String uri = baseURI.toASCIIString(); if (cache.containsKey(uri)) { logger.trace("Returning cached document."); return S9apiUtils.xdmToInputSource(runtime, cache.get(uri)); } } catch (URISyntaxException use) { logger.trace("URISyntaxException resolving entityResolver systemId: " + systemId); } catch (SaxonApiException sae) { throw new XProcException(sae); } if (entityResolver != null) { InputSource r = entityResolver.resolveEntity(publicId, systemId); return r; } else { return null; } }
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { logger.trace("ResolveEntity(" + publicId + "," + systemId + ")"); if (systemId == null) { return null; } try { URI baseURI = new URI(systemId); String uri = baseURI.toASCIIString(); if (cache.containsKey(uri)) { logger.trace("Returning cached document."); return S9apiUtils.xdmToInputSource(runtime, cache.get(uri)); } } catch (URISyntaxException use) { logger.trace("URISyntaxException resolving entityResolver systemId: " + systemId); } catch (SaxonApiException sae) { throw new XProcException(sae); } if (entityResolver != null) { InputSource r = entityResolver.resolveEntity(publicId, systemId); return r; } else { return null; } }
public void run10(XdmNode stylesheet, XdmNode document) { try { InputSource is = S9apiUtils.xdmToInputSource(runtime, stylesheet); TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer transformer = tfactory.newTransformer(new SAXSource(is)); transformer.setURIResolver(runtime.getResolver()); for (QName name : params.keySet()) { RuntimeValue v = params.get(name); transformer.setParameter(name.getClarkName(), v.getString()); } DOMResult result = new DOMResult(); is = S9apiUtils.xdmToInputSource(runtime, document); transformer.transform(new SAXSource(is), result); DocumentBuilder xdmBuilder = runtime.getConfiguration().getProcessor().newDocumentBuilder(); XdmNode xformed = xdmBuilder.build(new DOMSource(result.getNode())); // Can be null when nothing is written to the principle result tree... if (xformed != null) { // There used to be an attempt to set the system identifier of the xformed // document, but that's not allowed in Saxon 9.8. resultPipe.write(xformed); } } catch (SaxonApiException sae) { throw new XProcException(sae); } catch (TransformerConfigurationException tce) { throw new XProcException(tce); } catch (TransformerException te) { throw new XProcException(te); } }
public void run10(XdmNode stylesheet, XdmNode document) { try { InputSource is = S9apiUtils.xdmToInputSource(runtime, stylesheet); TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer transformer = tfactory.newTransformer(new SAXSource(is)); transformer.setURIResolver(runtime.getResolver()); for (QName name : params.keySet()) { RuntimeValue v = params.get(name); transformer.setParameter(name.getClarkName(), v.getString()); } DOMResult result = new DOMResult(); is = S9apiUtils.xdmToInputSource(runtime, document); transformer.transform(new SAXSource(is), result); DocumentBuilder xdmBuilder = runtime.getConfiguration().getProcessor().newDocumentBuilder(); XdmNode xformed = xdmBuilder.build(new DOMSource(result.getNode())); // Can be null when nothing is written to the principle result tree... if (xformed != null) { // There used to be an attempt to set the system identifier of the xformed // document, but that's not allowed in Saxon 9.8. resultPipe.write(xformed); } } catch (SaxonApiException sae) { throw new XProcException(sae); } catch (TransformerConfigurationException tce) { throw new XProcException(tce); } catch (TransformerException te) { throw new XProcException(te); } }
InputSource is = S9apiUtils.xdmToInputSource(runtime, schemaNode); is.setSystemId(schemaNode.getBaseURI().toASCIIString()); Schema schema = factory.newSchema(new SAXSource(is)); validator.setErrorHandler(new XSDErrorHandler()); InputSource docSource = S9apiUtils.xdmToInputSource(runtime, doc); docSource.setSystemId(doc.getBaseURI().toASCIIString());
InputSource is = S9apiUtils.xdmToInputSource(runtime, schemaNode); is.setSystemId(schemaNode.getBaseURI().toASCIIString()); Schema schema = factory.newSchema(new SAXSource(is)); validator.setErrorHandler(new XSDErrorHandler()); InputSource docSource = S9apiUtils.xdmToInputSource(runtime, doc); docSource.setSystemId(doc.getBaseURI().toASCIIString());
InputSource schemaSource = S9apiUtils.xdmToInputSource(runtime, schemaNode); schemaSource.setSystemId(schemaNode.getBaseURI().toASCIIString()); docBaseURI = doc.getBaseURI(); if (!verifier.verify(S9apiUtils.xdmToInputSource(runtime, doc))) { throw new XProcException(XProcException.err_E0001, "Document is not valid");
InputSource schemaSource = S9apiUtils.xdmToInputSource(runtime, schemaNode); schemaSource.setSystemId(schemaNode.getBaseURI().toASCIIString()); docBaseURI = doc.getBaseURI(); if (!verifier.verify(S9apiUtils.xdmToInputSource(runtime, doc))) { throw new XProcException(XProcException.err_E0001, "Document is not valid");
InputSource schemaSource = S9apiUtils.xdmToInputSource(runtime, schemaNode); schemaSource.setSystemId(schemaNode.getBaseURI().toASCIIString()); SAXSource source = new SAXSource(schemaSource);
InputSource schemaSource = S9apiUtils.xdmToInputSource(runtime, schemaNode); schemaSource.setSystemId(schemaNode.getBaseURI().toASCIIString()); SAXSource source = new SAXSource(schemaSource);
schemaInputSource = S9apiUtils.xdmToInputSource(runtime, schema); try { if (driver.loadSchema(schemaInputSource)) { InputSource din = S9apiUtils.xdmToInputSource(runtime, doc); if (!driver.validate(din)) { if (assertValid) {
schemaInputSource = S9apiUtils.xdmToInputSource(runtime, schema); try { if (driver.loadSchema(schemaInputSource)) { InputSource din = S9apiUtils.xdmToInputSource(runtime, doc); if (!driver.validate(din)) { if (assertValid) {
InputSource nvdl = S9apiUtils.xdmToInputSource(runtime, nvdldoc); InputSource doc = S9apiUtils.xdmToInputSource(runtime, srcdoc);
InputSource nvdl = S9apiUtils.xdmToInputSource(runtime, nvdldoc); InputSource doc = S9apiUtils.xdmToInputSource(runtime, srcdoc);