Package org.glassfish.hk2.xml.spi
Interface XmlServiceParser
- All Known Implementing Classes:
DomXmlParser,JAXBXmlParser
If an implementation of this exists it will be used to parse the XML file rather
than the default implementation which uses JAXB
- Author:
- jwells
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionThis tells the system whether or not it needs to pregenerate all proxies prior to parsing a document or if the proxies can be generated lazily<T> voidmarshal(OutputStream outputStream, XmlRootHandle<T> root, Map<String, Object> options) Marshalls this tree into the given stream.<T> TparseRoot(Model rootModel, InputStream input, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) This method must return an instance of the given class as the root of an XML graph<T> TparseRoot(Model rootModel, URI location, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) This method must return an instance of the given class as the root of an XML graph
-
Field Details
-
DEFAULT_PARSING_SERVICE
The default Xml parsing service will have this name- See Also:
-
STREAM_PARSING_SERVICE
A stream parsing service that does not use JAXB but an internal stream based implementation- See Also:
-
-
Method Details
-
parseRoot
<T> T parseRoot(Model rootModel, URI location, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) throws ExceptionThis method must return an instance of the given class as the root of an XML graph- Parameters:
rootModel- The Model object of the root to be parsedlocation- The location of the file to parselistener- A listener that must be called via the contract of Unmarshaller.Listeneroptions- optional (possibly null) options from the caller- Returns:
- The root object with all fields filled in from the given document
- Throws:
Exception
-
parseRoot
<T> T parseRoot(Model rootModel, InputStream input, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) throws ExceptionThis method must return an instance of the given class as the root of an XML graph- Parameters:
rootModel- The Model object of the root to be parsedinput- A non-null input stream. This stream will NOT be closed by this methodlistener- A listener that must be called via the contract of Unmarshaller.Listeneroptions- optional (possibly null) options from the caller- Returns:
- The root object with all fields filled in from the given document
- Throws:
Exception
-
getPreGenerationRequirement
PreGenerationRequirement getPreGenerationRequirement()This tells the system whether or not it needs to pregenerate all proxies prior to parsing a document or if the proxies can be generated lazily- Returns:
- The value that indicates whether or not the proxies can be loaded lazily or must be pre-generated prior to parsing a document
-
marshal
<T> void marshal(OutputStream outputStream, XmlRootHandle<T> root, Map<String, Object> options) throws IOExceptionMarshalls this tree into the given stream. Will hold the WRITE lock of this tree while it does so that the tree cannot change underneath while it is being written out. It will use a basic indentation and new-line scheme- Parameters:
outputStream- A non-closed output stream. This method will not close the output streamroot- The root of the tree to marshalloptions- optional (possibly null) options from the caller- Throws:
IOException- On any exception that might happen
-