Package javax.xml.parsers

Examples of javax.xml.parsers.DocumentBuilder.reset()


    try {
      parser = domFactory.newDocumentBuilder();
    } catch (ParserConfigurationException pce) {
      throw new RuntimeException(pce);
    }
    parser.reset();
    document = parser.parse(source);
    return document;
  }

  /**
 
View Full Code Here


                DocumentBuilder db = dbf.newDocumentBuilder();
               
                // Parse, reset the parser and then parse again.
                db.setErrorHandler(parserAPIUsage);
                db.parse(docURI);
                db.reset();
                db.setErrorHandler(parserAPIUsage);
                db.parse(docURI);
            }
            // "sax".equals(apiToUse)
            else {
View Full Code Here

            // whether a builder is ever logically returned to the pool.
            proxiedBuilder.setReturned(true);
        }
       
        DocumentBuilder unwrappedBuilder = proxiedBuilder.getProxiedBuilder();
        unwrappedBuilder.reset();
        SoftReference<DocumentBuilder> builderReference = new SoftReference<DocumentBuilder>(unwrappedBuilder);
       
        synchronized(builderPool) {
            if (builderPool.size() < maxPoolSize) {
                builderPool.push(builderReference);
View Full Code Here

            if (proxiedBuilder.getPoolVersion() != poolVersion) {
                return;
            }
           
            DocumentBuilder unwrappedBuilder = proxiedBuilder.getProxiedBuilder();
            unwrappedBuilder.reset();
            SoftReference<DocumentBuilder> builderReference = new SoftReference<DocumentBuilder>(unwrappedBuilder);

            if (builderPool.size() < maxPoolSize) {
                proxiedBuilder.setReturned(true);
                builderPool.push(builderReference);
View Full Code Here

    public static Document parse(String uri) throws TransformerException, IOException, SAXException, ParserConfigurationException {
        DocumentBuilder db = documentBuilder();
        try {
            return db.parse(uri);
        } finally {
            db.reset();
        }
    }

    public static Document parse(File f) throws TransformerException, IOException, SAXException, ParserConfigurationException {
        DocumentBuilder db = documentBuilder();
View Full Code Here

    public static Document parse(File f) throws TransformerException, IOException, SAXException, ParserConfigurationException {
        DocumentBuilder db = documentBuilder();
        try {
            return db.parse(f);
        } finally {
            db.reset();
        }
    }
    public static Document parse(File f, ErrorHandler errorHandler) throws TransformerException, IOException, SAXException, ParserConfigurationException {
        DocumentBuilder db = documentBuilder();
        db.setErrorHandler(errorHandler);
View Full Code Here

        DocumentBuilder db = documentBuilder();
        db.setErrorHandler(errorHandler);
        try {
            return db.parse(f);
        } finally {
            db.reset();
        }
    }

    public static void transform(Source xmlSource, Result outputTarget) throws TransformerException {
        Transformer t = transformer();
View Full Code Here

   */
  private static DocumentBuilder getBuilder() throws ParserConfigurationException {
    DocumentBuilder builder;
    if (canReuseBuilders) {
      builder = REUSABLE_BUILDER.get();
      builder.reset();
    } else {
      builder = BUILDER_FACTORY.newDocumentBuilder();
    }
    builder.setErrorHandler(ERROR_HANDLER);
    return builder;
View Full Code Here

            if (proxiedBuilder.getPoolVersion() != poolVersion) {
                return;
            }
           
            DocumentBuilder unwrappedBuilder = proxiedBuilder.getProxiedBuilder();
            unwrappedBuilder.reset();
            SoftReference<DocumentBuilder> builderReference = new SoftReference<DocumentBuilder>(unwrappedBuilder);

            if (builderPool.size() < maxPoolSize) {
                proxiedBuilder.setReturned(true);
                builderPool.push(builderReference);
View Full Code Here

            // whether a builder is ever logically returned to the pool.
            proxiedBuilder.setReturned(true);
        }
       
        DocumentBuilder unwrappedBuilder = proxiedBuilder.getProxiedBuilder();
        unwrappedBuilder.reset();
        SoftReference<DocumentBuilder> builderReference = new SoftReference<DocumentBuilder>(unwrappedBuilder);
       
        synchronized(builderPool) {
            if (builderPool.size() < maxPoolSize) {
                builderPool.push(builderReference);
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.