org.opensaml.xml.parse.ParserPool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xmltooling Show documentation
Show all versions of xmltooling Show documentation
XMLTooling-J is a low-level library that may be used to construct libraries that allow developers to work with
XML in a Java beans manner.
/*
* Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opensaml.xml.parse;
import java.io.InputStream;
import java.io.Reader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.validation.Schema;
import org.w3c.dom.Document;
/**
* A pool of XML parsers.
*/
public interface ParserPool {
/**
* Gets a builder from the pool.
*
* @return a builder from the pool
*
* @throws XMLParserException thrown if the document builder factory is misconfigured
*/
public DocumentBuilder getBuilder() throws XMLParserException;
/**
* Returns a builder to the pool.
*
* @param builder the builder to return
*/
public void returnBuilder(DocumentBuilder builder);
/**
* Convience method for creating a new document with a pooled builder.
*
* @return created document
*
* @throws XMLParserException thrown if there is a problem retrieving a builder
*/
public Document newDocument() throws XMLParserException;
/**
* Convience method for parsing an XML file using a pooled builder.
*
* @param input XML to parse
*
* @return 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
*/
public Document parse(InputStream input) throws XMLParserException;
/**
* Convience method for parsing an XML file using a pooled builder.
*
* @param input XML to parse
*
* @return 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
*/
public Document parse(Reader input) throws XMLParserException;
/**
* Gets the schema builders use to validate.
*
* @return the schema builders use to validate
*/
public Schema getSchema();
/**
* Sets the schema builders use to validate.
*
* @param newSchema the schema builders use to validate
*/
public void setSchema(Schema newSchema);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy