org.opensaml
Class XML.ParserPool

java.lang.Object
  extended byorg.opensaml.XML.ParserPool
All Implemented Interfaces:
org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Enclosing class:
XML

public static class XML.ParserPool
extends java.lang.Object
implements org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

Nested class that provides XML parsers as a pooled resource

Author:
Scott Cantor

Constructor Summary
XML.ParserPool()
          Constructor for the ParserPool object
 
Method Summary
 void error(org.xml.sax.SAXParseException e)
          Called by parser if an error is detected, currently just throws e
 void fatalError(org.xml.sax.SAXParseException exception)
          Called by parser if a fatal error is detected, does nothing
 org.apache.xerces.parsers.DOMParser get()
          Get a DOM parser suitable for our task
 org.w3c.dom.Document newDocument()
          Builds a new DOM document
 org.w3c.dom.Document parse(java.io.InputStream in)
          Parses a document using a pooled parser with the proper settings
 org.w3c.dom.Document parse(java.lang.String systemId)
          Parses a document using a pooled parser with the proper settings
 void put(org.apache.xerces.parsers.DOMParser p)
          Return a parser to the pool
 void registerSchema(java.lang.String namespace, java.lang.String schema, org.xml.sax.EntityResolver resolver)
          Registers an extension schema and optional resolver with the parser runtime
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          A customized entity resolver that utilizes internal machinery for the SAML, SOAP, and DSig schemas and chains to externally provided resolvers
 void warning(org.xml.sax.SAXParseException e)
          Called by parser if a warning is issued, currently logs the condition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML.ParserPool

public XML.ParserPool()
Constructor for the ParserPool object

Method Detail

get

public org.apache.xerces.parsers.DOMParser get()
                                        throws SAMLException
Get a DOM parser suitable for our task

Returns:
A DOM parser ready to use
Throws:
SAMLException - Raised if a system error prevents a parser from being created

parse

public org.w3c.dom.Document parse(java.io.InputStream in)
                           throws SAMLException,
                                  org.xml.sax.SAXException,
                                  java.io.IOException
Parses a document using a pooled parser with the proper settings

Parameters:
in - A stream containing the content to be parsed
Returns:
The DOM document resulting from the parse
Throws:
SAMLException - Raised if a parser is unavailable
org.xml.sax.SAXException - Raised if a parsing error occurs
java.io.IOException - Raised if an I/O error occurs

parse

public org.w3c.dom.Document parse(java.lang.String systemId)
                           throws SAMLException,
                                  org.xml.sax.SAXException,
                                  java.io.IOException
Parses a document using a pooled parser with the proper settings

Parameters:
systemId - The URI to parse
Returns:
The DOM document resulting from the parse
Throws:
SAMLException - Raised if a parser is unavailable
org.xml.sax.SAXException - Raised if a parsing error occurs
java.io.IOException - Raised if an I/O error occurs

newDocument

public org.w3c.dom.Document newDocument()
Builds a new DOM document

Returns:
An empty DOM document

registerSchema

public void registerSchema(java.lang.String namespace,
                           java.lang.String schema,
                           org.xml.sax.EntityResolver resolver)
Registers an extension schema and optional resolver with the parser runtime

Parameters:
namespace - The extension namespace
schema - The system ID of the extension schema
resolver - An optional entity resolver that can custom resolve the schema

put

public void put(org.apache.xerces.parsers.DOMParser p)
Return a parser to the pool

Parameters:
p - Description of Parameter

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
A customized entity resolver that utilizes internal machinery for the SAML, SOAP, and DSig schemas and chains to externally provided resolvers

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - The public identifier of the entity
systemId - The system identifier of the entity
Returns:
A source of bytes for the entity or null
Throws:
org.xml.sax.SAXException - Raised if an XML parsing problem occurs
java.io.IOException - Raised if an I/O problem is detected

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Called by parser if a fatal error is detected, does nothing

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Parameters:
exception - Describes the error
Throws:
org.xml.sax.SAXException - Can be raised to indicate an explicit error

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXParseException
Called by parser if an error is detected, currently just throws e

Specified by:
error in interface org.xml.sax.ErrorHandler
Parameters:
e - Description of Parameter
Throws:
org.xml.sax.SAXParseException - Can be raised to indicate an explicit error

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXParseException
Called by parser if a warning is issued, currently logs the condition

Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
e - Describes the warning
Throws:
org.xml.sax.SAXParseException - Can be raised to indicate an explicit error


Copyright ? 2002 UCAID. All Rights Reserved.