public class MediaWikiLoader extends Object
Generate the DOM for a MediaWiki XML document. In particular, this class uses JAXB to unmarshall an XML stream
into Java objects. This class is written specifically to support MediaWiki XML documents only because it expects the
root of the DOM to be a MediaWikiType
object.
Debug levels used:
PARSE_BEGIN_END
: Announce beginning and end of parsingModifier and Type | Class and Description |
---|---|
static class |
MediaWikiLoader.XMLConfigurationException
Exception describing a problem with the XML software setup.
|
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_PATH
Name of package containing schema-derived classes (i.e., the classes that correspond to each element in the
MediaWiki schema).
|
Modifier and Type | Method and Description |
---|---|
static Unmarshaller |
createUnmarshaller()
Create a JAXB
Unmarshaller for documents using the current MediaWiki schema. |
static JAXBElement<MediaWikiType> |
load(InputStream input,
edu.gvsu.kurmasz.warszawa.log.Log log)
Loads the entire XML document and returns a
JAXBElement<MediaWikiType> object representing the root. |
static JAXBElement<MediaWikiType> |
load(Source source,
edu.gvsu.kurmasz.warszawa.log.Log log)
Loads the entire XML document and returns a
JAXBElement<MediaWikiType> object representing the root. |
static JAXBElement<MediaWikiType> |
load(Source source,
edu.gvsu.kurmasz.warszawa.log.SimpleLog log,
Unmarshaller unmarshaller)
Loads the entire XML document and returns a
JAXBElement<MediaWikiType> object representing the root. |
public static final String CONTEXT_PATH
public static Unmarshaller createUnmarshaller()
Unmarshaller
for documents using the current MediaWiki schema.Unmarshaller
for documents using the current MediaWiki schema.MediaWikiLoader.XMLConfigurationException
- if there is a problem creating the JAXB contextpublic static JAXBElement<MediaWikiType> load(Source source, edu.gvsu.kurmasz.warszawa.log.SimpleLog log, Unmarshaller unmarshaller) throws JAXBException
JAXBElement<MediaWikiType>
object representing the root.source
- the source of the XML datalog
- a Log
to which to report progressunmarshaller
- the JAXB UnmarshallerJAXBElement<MediaWikiType>
object representing the root of the loaded XML document.JAXBException
- if there is a problem generating the DOMIllegalArgumentException
- if any parameters are null
public static JAXBElement<MediaWikiType> load(Source source, edu.gvsu.kurmasz.warszawa.log.Log log) throws JAXBException
JAXBElement<MediaWikiType>
object representing the root.source
- the source of the XML datalog
- a Log
to which to report progressJAXBElement<MediaWikiType>
object representing the root of the loaded XML document.JAXBException
- if there is a problem generating the DOMMediaWikiLoader.XMLConfigurationException
- if there is a problem creating the JAXB contextIllegalArgumentException
- if any parameters are null
public static JAXBElement<MediaWikiType> load(InputStream input, edu.gvsu.kurmasz.warszawa.log.Log log) throws JAXBException
JAXBElement<MediaWikiType>
object representing the root.input
- the source of the XML datalog
- a Log
to which to report progressJAXBElement<MediaWikiType>
object representing the root of the loaded XML document.JAXBException
- if there is a problem generating the DOMMediaWikiLoader.XMLConfigurationException
- if there is a problem creating the JAXB contextIllegalArgumentException
- if any parameters are null