Module org.mule.runtime.dsl.api
Class XmlConfigurationDocumentLoader
java.lang.Object
org.mule.runtime.dsl.api.xml.parser.XmlConfigurationDocumentLoader
Loads a mule configuration file into a
Document object.
If when loading the configuration one, or more, ErrorHandler.error(SAXParseException) are call, at the end of
loadDocument(Supplier, EntityResolver, String, InputStream) will throw an exception containing all the errors.- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionloadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, String filename, InputStream inputStream, EntityResolver entityResolver) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.loadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, EntityResolver entityResolver, String filename, InputStream inputStream) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.loadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, EntityResolver entityResolver, String filename, InputStream inputStream, org.mule.apache.xerces.xni.grammars.XMLGrammarPool xmlGrammarPool) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.Creates anXmlConfigurationDocumentLoaderthat will ignore XSD validation when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method.Creates anXmlConfigurationDocumentLoaderusing the defaultDefaultXmlGathererErrorHandlerFactoryto instantiateXmlGathererErrorHandlers objects when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method.schemaValidatingDocumentLoader(XmlGathererErrorHandlerFactory errorHandlerFactory) Creates anXmlConfigurationDocumentLoaderusing a parametrizedXmlGathererErrorHandlerFactoryto instantiateXmlGathererErrorHandlers objects when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method.
-
Method Details
-
schemaValidatingDocumentLoader
Creates anXmlConfigurationDocumentLoaderusing the defaultDefaultXmlGathererErrorHandlerFactoryto instantiateXmlGathererErrorHandlers objects when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method. Using the default constructor implies that all XSD validations will take place and, at the end of the parsing, all the errors will be contained in anMuleRuntimeExceptionwhich will be thrown.- Returns:
- a new instance of
XmlConfigurationDocumentLoader
-
schemaValidatingDocumentLoader
public static XmlConfigurationDocumentLoader schemaValidatingDocumentLoader(XmlGathererErrorHandlerFactory errorHandlerFactory) Creates anXmlConfigurationDocumentLoaderusing a parametrizedXmlGathererErrorHandlerFactoryto instantiateXmlGathererErrorHandlers objects when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method. Depending on what type ofXmlGathererErrorHandlerthe factory returns, theloadDocument(Supplier, EntityResolver, String, InputStream)method will not thrown any exception ifXmlGathererErrorHandler.getErrors()is an empty list.- Parameters:
errorHandlerFactory- to createXmlGathererErrorHandlerin theloadDocument(Supplier, EntityResolver, String, InputStream)- Returns:
- a new instance of
XmlConfigurationDocumentLoader
-
noValidationDocumentLoader
Creates anXmlConfigurationDocumentLoaderthat will ignore XSD validation when executing theloadDocument(Supplier, EntityResolver, String, InputStream)method.- Returns:
- a new instance of
XmlConfigurationDocumentLoader
-
loadDocument
public Document loadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, String filename, InputStream inputStream, EntityResolver entityResolver) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.- Parameters:
inputStream- the input stream with the XML configuration content.- Returns:
- a new
Documentobject with the provided content. - Throws:
org.mule.runtime.api.exception.MuleRuntimeException- if an error occurs inMuleDocumentLoaderfactory, or if the currentfilenamecontains 1 or more errors.
-
loadDocument
public Document loadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, EntityResolver entityResolver, String filename, InputStream inputStream) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.- Parameters:
entityResolver- resolver for XML schemas.filename- name of the file to display a better error messages (if there are any). Non null.inputStream- the input stream with the XML configuration content.- Returns:
- a new
Documentobject with the provided content. - Throws:
org.mule.runtime.api.exception.MuleRuntimeException- if an error occurs inMuleDocumentLoaderfactory, or if the currentfilenamecontains 1 or more errors.
-
loadDocument
public Document loadDocument(Supplier<SAXParserFactory> saxParserFactorySupplier, EntityResolver entityResolver, String filename, InputStream inputStream, org.mule.apache.xerces.xni.grammars.XMLGrammarPool xmlGrammarPool) Creates aDocumentfrom anInputStreamwith the required configuration of a mule configuration file parsing.- Parameters:
entityResolver- resolver for XML schemas.filename- name of the file to display a better error messages (if there are any). Non null.inputStream- the input stream with the XML configuration content.xmlGrammarPool- aXMLGrammarPoolpool to be used while file parsing.- Returns:
- a new
Documentobject with the provided content. - Throws:
org.mule.runtime.api.exception.MuleRuntimeException- if an error occurs inMuleDocumentLoaderfactory, or if the currentfilenamecontains 1 or more errors.
-