|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensaml.XML.ParserPool
public static class XML.ParserPool
Nested class that provides XML parsers as a pooled resource
| Field Summary | |
|---|---|
protected SAMLConfig |
config
OpenSAML configuration |
| Constructor Summary | |
|---|---|
XML.ParserPool()
Constructor for the ParserPool object |
|
| Method Summary | |
|---|---|
void |
error(SAXParseException e)
Called by parser if an error is detected, currently just throws e |
void |
fatalError(SAXParseException e)
Called by parser if a fatal error is detected, does nothing |
DocumentBuilder |
get()
Get a DocumentBuilder for the default Schema |
DocumentBuilder |
get(javax.xml.validation.Schema schema)
Get a DOM parser suitable for our task |
javax.xml.validation.Schema |
getDefaultSchema()
|
javax.xml.validation.Schema |
getSchemaSAML10()
|
javax.xml.validation.Schema |
getSchemaSAML11()
|
Document |
newDocument()
Builds a new DOM document |
Document |
parse(InputSource in,
javax.xml.validation.Schema schema)
Parses a document using a pooled parser with the proper settings |
Document |
parse(InputStream in)
Short form of parse to support legacy callers |
Document |
parse(String systemId)
Legacy version of parse where the default Schema is implied |
Document |
parse(String systemId,
javax.xml.validation.Schema schema)
Parses a document using a pooled parser with the proper settings |
void |
put(DocumentBuilder p)
Return a parser to the pool |
void |
registerSchemas(Map exts)
Registers one or more extension schemas in the default schema set. |
InputSource |
resolveEntity(String publicId,
String systemId)
|
void |
setDefaultSchema(javax.xml.validation.Schema schema)
Deprecated. |
void |
setDefaultSchemas(javax.xml.validation.Schema schema10,
javax.xml.validation.Schema schema11)
Directly installs a custom schema. |
void |
warning(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 |
| Field Detail |
|---|
protected SAMLConfig config
| Constructor Detail |
|---|
public XML.ParserPool()
To demonstrate the technology, the current version of this code creates both 1.0 and 1.1 Schema objects. However, it then selects only one of the two to use. Future code could refine this and maintain two pools of parsers.
| Method Detail |
|---|
public void setDefaultSchema(javax.xml.validation.Schema schema)
schema -
public void setDefaultSchemas(javax.xml.validation.Schema schema10,
javax.xml.validation.Schema schema11)
schema10 - The schemas to use when handling SAML 1.0schema11 - The schemas to use when handling SAML 1.1public javax.xml.validation.Schema getDefaultSchema()
public javax.xml.validation.Schema getSchemaSAML10()
public javax.xml.validation.Schema getSchemaSAML11()
public void registerSchemas(Map exts)
Note that you must insure that any dependencies are specified ahead of the schemas that require them, because they must be loaded by the SchemaFactory before they are required.
exts - A map of EntityResolver interfaces keyed by "systemId" to
enable the SAML runtime to obtain the schema instances anytime required
public DocumentBuilder get(javax.xml.validation.Schema schema)
throws SAMLException
schema - JAXP 1.3 Schema object (or null for no XSD)
SAMLException - Raised if a system error prevents a parser
from being created
public DocumentBuilder get()
throws SAMLException
Note: This uses the default (probably SAML 1.1) Schema. To get an non-schema-validating parser, call "get(null)".
SAMLException - can't create a DocumentBuilder
public Document parse(InputSource in,
javax.xml.validation.Schema schema)
throws SAMLException,
SAXException,
IOException
in - A stream containing the content to
be parsedschema - Schema object or null
SAMLException - Raised if a parser is unavailable
SAXException - Raised if a parsing error occurs
IOException - Raised if an I/O error occurs
public Document parse(InputStream in)
throws SAMLException,
SAXException,
IOException
This version is not preferred. If the caller converts the InputStream to an InputSource, then it can append a file name as the systemId. Here we only get the InputStream and create an InputSource with no identifier to be used in logging or generating error messages.
in - InputStream of XML to be parsed
SAMLException - Raised if a parser is unavailable
SAXException - Raised if a parsing error occurs
IOException - Raised if an I/O error occurs
public Document parse(String systemId,
javax.xml.validation.Schema schema)
throws SAMLException,
SAXException,
IOException
systemId - The URI to parse
SAMLException - Raised if a parser is unavailable
SAXException - Raised if a parsing error occurs
IOException - Raised if an I/O error occurs
public Document parse(String systemId)
throws SAMLException,
SAXException,
IOException
systemId - URI to be parsed, becomes systemId of InputSource
SAMLException - Raised if a parser is unavailable
SAXException - Raised if a parsing error occurs
IOException - Raised if an I/O error occurspublic Document newDocument()
In JAXP, you get a new empty DOM document from a DocumentBuilder. There is no evidence that the Schema is attached to the DOM, so it doesn't matter what pool to use.
public void put(DocumentBuilder p)
p - Description of Parameter
public void fatalError(SAXParseException e)
throws SAXException
fatalError in interface ErrorHandlerexception - Describes the error
SAXException - Can be raised to indicate an explicit error
public void error(SAXParseException e)
throws SAXParseException
error in interface ErrorHandlere - Description of Parameter
SAXParseException - Can be raised to indicate an explicit
error
public void warning(SAXParseException e)
throws SAXParseException
warning in interface ErrorHandlere - Describes the warning
SAXParseException - Can be raised to indicate an explicit
error
public InputSource resolveEntity(String publicId,
String systemId)
throws SAXException,
IOException
resolveEntity in interface EntityResolverSAXException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||