public class SchemaModuleUtil
extends java.lang.Object
SchemaModules, including marshalling and unmarshalling with
JAXB.| Constructor and Description |
|---|
SchemaModuleUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.ls.LSResourceResolver |
createResourceResolver(java.util.Set<SchemaModule<?>> modules,
ProgressIndicator progress)
Create an
LSResourceResolver that will use the supplied SchemaModules to
find an XSD from its namespace. |
static javax.xml.validation.Schema |
getSchema(java.util.Collection<SchemaModule<?>> possibleModules,
org.w3c.dom.ls.LSResourceResolver resourceResolver,
ProgressIndicator progress)
Creates a
Schema from a collection of SchemaModules, with a given
LSResourceResolver (probably obtained from
createResourceResolver(Set, ProgressIndicator). |
static void |
marshal(javax.xml.bind.JAXBElement element,
java.util.Collection<SchemaModule<?>> possibleModules,
java.io.OutputStream out,
org.w3c.dom.ls.LSResourceResolver resourceResolver,
ProgressIndicator progress)
Transform the given
JAXBElement into xml, using JAXB and the schemas provided by the
given SchemaModules. |
static java.lang.Object |
unmarshal(java.io.InputStream xml,
java.util.Collection<SchemaModule<?>> possibleModules,
org.w3c.dom.ls.LSResourceResolver resourceResolver,
boolean strict,
ProgressIndicator progress)
Use JAXB to create POJOs from the given XML.
|
@Nullable
public static org.w3c.dom.ls.LSResourceResolver createResourceResolver(@NonNull
java.util.Set<SchemaModule<?>> modules,
@NonNull
ProgressIndicator progress)
LSResourceResolver that will use the supplied SchemaModules to
find an XSD from its namespace. This must be used when marshalling/unmarshalling if any
SchemaModules contain XSDs which import others without specifying a complete
schemaLocation.@NonNull public static javax.xml.validation.Schema getSchema(java.util.Collection<SchemaModule<?>> possibleModules, @Nullable org.w3c.dom.ls.LSResourceResolver resourceResolver, ProgressIndicator progress)
Schema from a collection of SchemaModules, with a given
LSResourceResolver (probably obtained from
createResourceResolver(Set, ProgressIndicator). Any warnings or errors are
logged to the given ProgressIndicator.@Nullable
public static java.lang.Object unmarshal(@NonNull
java.io.InputStream xml,
@NonNull
java.util.Collection<SchemaModule<?>> possibleModules,
@Nullable
org.w3c.dom.ls.LSResourceResolver resourceResolver,
boolean strict,
@NonNull
ProgressIndicator progress)
throws javax.xml.bind.JAXBException
xml - The XML to read. The stream will be closed after being read.possibleModules - The SchemaModules that are available to parse the XML.resourceResolver - Resolver for any imported XSDs.progress - For logging.javax.xml.bind.JAXBException - if there is an error during unmarshalling.
TODO: maybe templatize and return a nicer type.public static void marshal(@NonNull
javax.xml.bind.JAXBElement element,
@NonNull
java.util.Collection<SchemaModule<?>> possibleModules,
@NonNull
java.io.OutputStream out,
@Nullable
org.w3c.dom.ls.LSResourceResolver resourceResolver,
@NonNull
ProgressIndicator progress)
JAXBElement into xml, using JAXB and the schemas provided by the
given SchemaModules.