Examples of DocumentPool


Examples of client.net.sf.saxon.ce.om.DocumentPool

        return new StringValue(s);
    }

    public static AnyURIValue getDocumentURI(NodeInfo node, XPathContext c) {
        if (node.getNodeKind() == Type.DOCUMENT) {
            DocumentPool pool = c.getController().getDocumentPool();
            String docURI = pool.getDocumentURI(node);
            if (docURI == null) {
                docURI = node.getSystemId();
            }
            if (docURI == null) {
                return null;
View Full Code Here

Examples of client.net.sf.saxon.ce.om.DocumentPool

    }

    private boolean docAvailable(String href, XPathContext context) throws XPathException {
        try {
            DocumentURI documentKey = DocumentFn.computeDocumentKey(href, expressionBaseURI);
            DocumentPool pool = context.getController().getDocumentPool();
            if (pool.isMarkedUnavailable(documentKey)) {
                return false;
            }
            DocumentInfo doc = pool.find(documentKey);
            if (doc != null) {
                return true;
            }
            Item item = DocumentFn.makeDoc(href, expressionBaseURI, context, getSourceLocator());
            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;
        }
View Full Code Here

Examples of net.sf.saxon.om.DocumentPool

            case DOCUMENT_URI:
                // If the node is in the document pool, get the URI under which it is registered.
                // Otherwise, return its systemId.
                if (node.getNodeKind() == Type.DOCUMENT) {
                    DocumentPool pool = c.getController().getDocumentPool();
                    String docURI = pool.getDocumentURI(node);
                    if (docURI == null) {
                        docURI = node.getSystemId();
                    }
                    if (docURI == null) {
                        return null;
View Full Code Here

Examples of net.sf.saxon.om.DocumentPool

    }

    private boolean docAvailable(String href, XPathContext context) throws URISyntaxException {
        try {
            String documentKey = Document.computeDocumentKey(href, expressionBaseURI, context);
            DocumentPool pool = context.getController().getDocumentPool();
            if (pool.isMarkedUnavailable(documentKey)) {
                return false;
            }
            DocumentInfo doc = pool.find(documentKey);
            if (doc != null) {
                return true;
            }
            Item item = Document.makeDoc(href, expressionBaseURI, context, this);
            if (item != null) {
                return true;
            } else {
                // The document does not exist; ensure that this remains the case
                pool.markUnavailable(documentKey);
                return false;
            }
        } catch (Exception err) {
            try {
                new URI(href);
View Full Code Here

Examples of net.sf.saxon.om.DocumentPool

        if (obj instanceof DocumentInfo) {
            String systemId = ((DocumentInfo)obj).getSystemId();
            try {
                if (systemId != null && new URI(systemId).isAbsolute()) {
                    DocumentPool pool = context.getController().getDocumentPool();
                    if (pool.find(systemId) == null) {
                        pool.add(((DocumentInfo)obj), systemId);
                    }
                }
            } catch (URISyntaxException err) {
                // ignore it
            }
View Full Code Here

Examples of net.sf.saxon.om.DocumentPool

            case DOCUMENT_URI:
                // If the node is in the document pool, get the URI under which it is registered.
                // Otherwise, return its systemId.
                if (node.getNodeKind() == Type.DOCUMENT) {
                    DocumentPool pool = c.getController().getDocumentPool();
                    String docURI = pool.getDocumentURI(node);
                    if (docURI == null) {
                        docURI = node.getSystemId();
                    }
                    if (docURI == null) {
                        return null;
View Full Code Here

Examples of nux.xom.pool.DocumentPool

   */ 
  protected void run() throws Exception {   
    try {
      final boolean isBench2 = (runs > 1);
      final boolean isBench = (runs > 1 && iterations > 0);     
      final DocumentPool docPool = createDocumentPool(isBench);

      DocumentURIResolver resolver = new DocumentURIResolver() {
        public Document resolve(String href, String baseURI) throws ParsingException, IOException, TransformerException {
          String systemID = new net.sf.saxon.StandardURIResolver(null).
            resolve(href, baseURI).getSystemId();
//          System.err.println(systemID);
          return docPool.getDocument(URI.create(systemID));
        }
      };

      // prepare XQuery pool
      XQueryPool queryPool = new XQueryPool(
          new PoolConfig(), new XQueryFactory(null, resolver));
     
      ResultSequenceSerializer serializer = new ResultSequenceSerializer();
      serializer.setAlgorithm(algorithm);
      serializer.setEncoding(encoding);
      serializer.setIndent(indent);
     
      // now do the real work
      long runsStart = System.currentTimeMillis();
      for (int run=0; run < runs; run++) {
        if (isBench) {
          System.out.println("\n\n******************************************");
          System.out.println("run = " + run + ":");
        }
        for (int i=0; i < queries.size(); i++) {
          long start = System.currentTimeMillis();
          long serializationTime = 0;
          Object query = queries.get(i);
          XQuery xquery;
          if (query instanceof String) {
            xquery = queryPool.getXQuery((String)query, baseURI);
          } else if (query instanceof File) {
            xquery = queryPool.getXQuery((File)query, baseURI);
          } else {
            xquery = null; // disable XQuery for benchmarking
          }
         
          if (isBench) {
            System.out.println("query = " +query);
          }
          if (explain && run == 0 && xquery != null) {
            System.out.println("explain = \n" + xquery.explain());
          }
         
          XQuery morpher;
          if (update instanceof String) {
            morpher = queryPool.getXQuery((String)update, null);
          } else if (update instanceof File) {
            morpher = queryPool.getXQuery((File)update, null);
          } else {
            morpher = null;
          }
         
          int numSerials = 0;
          for (int j=0; j < inputFiles.length; j++) {
            Document doc = null;
            if (inputFiles[j] != null) {
              doc = docPool.getDocument(new File(inputFiles[j]));
            }
            if (explain && doc != null) {
              System.out.println("stats=" + toStatisticsString(doc));
            }

View Full Code Here

Examples of nux.xom.pool.DocumentPool

          throw new UsageException("Illegal validate option: " + validate);
        }
      }
    };
   
    return new DocumentPool(
      new DocumentMap(
        new PoolConfig().
          setCompressionLevel(docPoolCompression).
          setCapacity(docPoolCapacity)),
        docFactory);
View Full Code Here

Examples of org.pdf4j.saxon.om.DocumentPool

            case DOCUMENT_URI:
                // If the node is in the document pool, get the URI under which it is registered.
                // Otherwise, return its systemId.
                if (node.getNodeKind() == Type.DOCUMENT) {
                    DocumentPool pool = c.getController().getDocumentPool();
                    String docURI = pool.getDocumentURI(node);
                    if (docURI == null) {
                        docURI = node.getSystemId();
                    }
                    if (docURI == null) {
                        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.