Package org.glassfish.hk2.xml.internal
Class DomXmlParser
java.lang.Object
org.glassfish.hk2.xml.internal.DomXmlParser
- All Implemented Interfaces:
XmlServiceParser
@Singleton
@Visibility(LOCAL)
@Named("StreamXmlParsingService")
@Rank(1)
public class DomXmlParser
extends Object
implements XmlServiceParser
- Author:
- jwells
-
Field Summary
Fields inherited from interface org.glassfish.hk2.xml.spi.XmlServiceParser
DEFAULT_PARSING_SERVICE, STREAM_PARSING_SERVICE -
Constructor Summary
Constructors -
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
-
Constructor Details
-
DomXmlParser
public DomXmlParser()
-
-
Method Details
-
parseRoot
public <T> T parseRoot(Model rootModel, URI location, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) throws ExceptionDescription copied from interface:XmlServiceParserThis method must return an instance of the given class as the root of an XML graph- Specified by:
parseRootin interfaceXmlServiceParser- 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
public <T> T parseRoot(Model rootModel, InputStream input, jakarta.xml.bind.Unmarshaller.Listener listener, Map<String, Object> options) throws ExceptionDescription copied from interface:XmlServiceParserThis method must return an instance of the given class as the root of an XML graph- Specified by:
parseRootin interfaceXmlServiceParser- 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
Description copied from interface:XmlServiceParserThis 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- Specified by:
getPreGenerationRequirementin interfaceXmlServiceParser- 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
public <T> void marshal(OutputStream outputStream, XmlRootHandle<T> root, Map<String, Object> options) throws IOExceptionDescription copied from interface:XmlServiceParserMarshalls 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- Specified by:
marshalin interfaceXmlServiceParser- 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
-