public void update(NodeInfo node, Controller controller) throws XPathException { try { DocumentPool pool = controller.getDocumentPool(); String documentURI = pool.getDocumentURI(node); if (documentURI != null) { QueryResult.rewriteToDisk(node, outputProps, backup, (showTime ? System.err : null)); } else if (showTime) { System.err.println("Updated document discarded because it was not read using doc()"); } } catch (XPathException err) { System.err.println(err.getMessage()); errors.add(err); } } };
/** * Remove a document from the document pool. The effect is that the document becomes eligible for * garbage collection, allowing memory to be released when processing of the document has finished. * The downside is that a subsequent call on document() with the same URI causes the document to be * reloaded and reparsed, and the new nodes will have different node identity from the old. * * @param context the evaluation context (supplied implicitly by the call mechanism) * @param doc the document to be released from the document pool * @return the document that was released. This allows a call such as * select="saxon:discard-document(document('a.xml'))" */ public static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc) { if (doc == null) { return null; } Controller c = context.getController(); String uri = c.getDocumentPool().getDocumentURI(doc); if (uri != null) { c.removeUnavailableOutputDestination(uri); } return c.getDocumentPool().discard(doc); }
/** * Remove a document from the document pool. The effect is that the document becomes eligible for * garbage collection, allowing memory to be released when processing of the document has finished. * The downside is that a subsequent call on document() with the same URI causes the document to be * reloaded and reparsed, and the new nodes will have different node identity from the old. * * @param context the evaluation context (supplied implicitly by the call mechanism) * @param doc the document to be released from the document pool * @return the document that was released. This allows a call such as * select="saxon:discard-document(document('a.xml'))" */ public static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc) { if (doc == null) { return null; } Controller c = context.getController(); String uri = c.getDocumentPool().getDocumentURI(doc); if (uri != null) { c.removeUnavailableOutputDestination(uri); } return c.getDocumentPool().discard(doc); }
/** * Remove a document from the document pool. The effect is that the document becomes eligible for * garbage collection, allowing memory to be released when processing of the document has finished. * The downside is that a subsequent call on document() with the same URI causes the document to be * reloaded and reparsed, and the new nodes will have different node identity from the old. * * @param context the evaluation context (supplied implicitly by the call mechanism) * @param doc the document to be released from the document pool * @return the document that was released. This allows a call such as * select="saxon:discard-document(document('a.xml'))" */ public static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc) { if (doc == null) { return null; } Controller c = context.getController(); String uri = c.getDocumentPool().getDocumentURI(doc); if (uri != null) { c.removeUnavailableOutputDestination(uri); } return c.getDocumentPool().discard(doc); }
public static AnyURIValue getDocumentURI(NodeInfo node, XPathContext c) { if (node.getNodeKind() == Type.DOCUMENT) { Object o = node.getTreeInfo().getUserData("saxon:document-uri"); if (o instanceof String) { return o.toString().isEmpty() ? null : new AnyURIValue(o.toString()); } final Controller controller = c.getController(); assert controller != null; DocumentPool pool = controller.getDocumentPool(); String docURI = pool.getDocumentURI(node); if (docURI == null) { docURI = node.getSystemId(); } if (docURI == null) { return null; } else if ("".equals(docURI)) { return null; } else { return new AnyURIValue(docURI); } } else { return null; } }
public static AnyURIValue getDocumentURI(NodeInfo node, XPathContext c) { if (node.getNodeKind() == Type.DOCUMENT) { Object o = node.getTreeInfo().getUserData("saxon:document-uri"); if (o instanceof String) { return o.toString().isEmpty() ? null : new AnyURIValue(o.toString()); } final Controller controller = c.getController(); assert controller != null; DocumentPool pool = controller.getDocumentPool(); String docURI = pool.getDocumentURI(node); if (docURI == null) { docURI = node.getSystemId(); } if (docURI == null) { return null; } else if ("".equals(docURI)) { return null; } else { return new AnyURIValue(docURI); } } else { return null; } }
if (controller.getDocumentPool().contains(doc)) { context.getController().setUserData(doc, "saxon:key-index-list", indexList); } else {
if (controller.getDocumentPool().contains(doc)) { context.getController().setUserData(doc, "saxon:key-index-list", indexList); } else {
try { if (systemId != null && new URI(systemId).isAbsolute()) { DocumentPool pool = context.getController().getDocumentPool(); if (pool.find(systemId) == null) { pool.add(((DocumentInfo)obj), systemId);
UpdateAgent agent = (node, controller) -> { try { DocumentPool pool = controller.getDocumentPool(); String documentURI = pool.getDocumentURI(node); if (documentURI != null) {
UpdateAgent agent = (node, controller) -> { try { DocumentPool pool = controller.getDocumentPool(); String documentURI = pool.getDocumentURI(node); if (documentURI != null) {
try { if (systemId != null && new URI(systemId).isAbsolute()) { DocumentPool pool = context.getController().getDocumentPool(); if (pool.find(systemId) == null) { pool.add(((DocumentInfo)obj), systemId);
try { if (systemId != null && new URI(systemId).isAbsolute()) { DocumentPool pool = getDocumentPool(); if (pool.find(systemId) == null) { pool.add(((NodeInfo) val).getTreeInfo(), systemId);
try { if (systemId != null && new URI(systemId).isAbsolute()) { DocumentPool pool = getDocumentPool(); if (pool.find(systemId) == null) { pool.add(((NodeInfo) val).getTreeInfo(), systemId);
public boolean docAvailable(String href, XPathContext context) { try { PackageData packageData = getRetainedStaticContext().getPackageData(); DocumentURI documentKey = DocumentFn.computeDocumentKey(href, getStaticBaseUriString(), packageData, context); DocumentPool pool = context.getController().getDocumentPool(); if (pool.isMarkedUnavailable(documentKey)) { return false; } TreeInfo doc = pool.find(documentKey); if (doc != null) { return true; } Item item = DocumentFn.makeDoc(href, getStaticBaseUriString(), packageData, null, context, null, true); if (item != null) { return true; } else { // The document does not exist; ensure that this remains the case pool.markUnavailable(documentKey); return false; } } catch (XPathException e) { return false; } }
public boolean docAvailable(String href, XPathContext context) { try { PackageData packageData = getRetainedStaticContext().getPackageData(); DocumentURI documentKey = DocumentFn.computeDocumentKey(href, getStaticBaseUriString(), packageData, context); DocumentPool pool = context.getController().getDocumentPool(); if (pool.isMarkedUnavailable(documentKey)) { return false; } TreeInfo doc = pool.find(documentKey); if (doc != null) { return true; } Item item = DocumentFn.makeDoc(href, getStaticBaseUriString(), packageData, null, context, null, true); if (item != null) { return true; } else { // The document does not exist; ensure that this remains the case pool.markUnavailable(documentKey); return false; } } catch (XPathException e) { return false; } }
TreeInfo doc = controller.getDocumentPool().find(documentKey); Source source = null; if (doc != null) {
DocumentPool pool = c.getController().getDocumentPool(); String docURI = pool.getDocumentURI(node); if (docURI == null) {
DocumentPool pool = c.getController().getDocumentPool(); String docURI = pool.getDocumentURI(node); if (docURI == null) {
DocumentPool pool = c.getController().getDocumentPool(); String docURI = pool.getDocumentURI(node); if (docURI == null) {