net.shibboleth.utilities.java.support.xml
Interface ParserPool

All Superinterfaces:
Component, DestructableComponent
All Known Implementing Classes:
BasicParserPool

public interface ParserPool
extends DestructableComponent

A pool of XML parsers.


Method Summary
 DocumentBuilder getBuilder()
          Gets a builder from the pool.
 Document newDocument()
          Convenience method for creating a new document with a pooled builder.
 Document parse(InputStream input)
          Convenience method for parsing an XML file using a pooled builder.
 Document parse(Reader input)
          Convenience method for parsing an XML file using a pooled builder.
 void returnBuilder(DocumentBuilder builder)
          Returns a builder to the pool.
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
 

Method Detail

getBuilder

@Nonnull
DocumentBuilder getBuilder()
                           throws XMLParserException
Gets a builder from the pool.

Returns:
a builder from the pool
Throws:
XMLParserException - thrown if the document builder factory is misconfigured

returnBuilder

void returnBuilder(@Nullable
                   DocumentBuilder builder)
Returns a builder to the pool.

Parameters:
builder - the builder to return

newDocument

@Nonnull
Document newDocument()
                     throws XMLParserException
Convenience method for creating a new document with a pooled builder.

Returns:
created document
Throws:
XMLParserException - thrown if there is a problem retrieving a builder

parse

@Nonnull
Document parse(@Nonnull
                       InputStream input)
               throws XMLParserException
Convenience method for parsing an XML file using a pooled builder.

Parameters:
input - XML to parse
Returns:
parsed document
Throws:
XMLParserException - thrown if there is a problem retrieving a builder, the input stream can not be read, or the XML was invalid

parse

@Nonnull
Document parse(@Nonnull
                       Reader input)
               throws XMLParserException
Convenience method for parsing an XML file using a pooled builder.

Parameters:
input - XML to parse
Returns:
parsed document
Throws:
XMLParserException - thrown if there is a problem retrieving a builder, the input stream can not be read, or the XML was invalid


Copyright © 1999-2012. All Rights Reserved.