use of eu.esdihumboldt.hale.io.gml.reader.internal.XmlInstanceReader in project hale by halestudio.
the class FilterTest method loadXMLInstances.
private InstanceCollection loadXMLInstances(URI schemaLocation, URI xmlLocation) throws IOException, IOProviderConfigurationException {
SchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(null);
reader.setSource(new DefaultInputSupplier(schemaLocation));
IOReport schemaReport = reader.execute(null);
assertTrue(schemaReport.isSuccess());
Schema sourceSchema = reader.getSchema();
//
InstanceReader instanceReader = new XmlInstanceReader();
instanceReader.setSource(new DefaultInputSupplier(xmlLocation));
instanceReader.setSourceSchema(sourceSchema);
IOReport instanceReport = instanceReader.execute(null);
assertTrue(instanceReport.isSuccess());
return instanceReader.getInstances();
}
use of eu.esdihumboldt.hale.io.gml.reader.internal.XmlInstanceReader in project hale by halestudio.
the class TestUtil method loadInstances.
/**
* Loads an instance collection from the specified XML file with the given
* source types.
*
* @param location the URI specifying the location of the xml instance file
* @param types the type index
* @return the loaded instance collection
* @throws IOException if loading the instance failed
* @throws IOProviderConfigurationException if configuring the instance
* reader failed
*/
public static InstanceCollection loadInstances(URI location, Schema types) throws IOProviderConfigurationException, IOException {
DefaultInputSupplier input = new DefaultInputSupplier(location);
XmlInstanceReader instanceReader = new XmlInstanceReader();
instanceReader.setSource(input);
instanceReader.setSourceSchema(types);
IOReport report = instanceReader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return instanceReader.getInstances();
}
use of eu.esdihumboldt.hale.io.gml.reader.internal.XmlInstanceReader in project hale by halestudio.
the class PropertyResolverTest method loadXMLInstances.
private InstanceCollection loadXMLInstances(URI schemaLocation, URI xmlLocation) throws IOException, IOProviderConfigurationException {
SchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(null);
reader.setSource(new DefaultInputSupplier(schemaLocation));
IOReport schemaReport = reader.execute(null);
assertTrue(schemaReport.isSuccess());
Schema sourceSchema = reader.getSchema();
//
InstanceReader instanceReader = new XmlInstanceReader();
instanceReader.setParameter(XmlInstanceReader.PARAM_IGNORE_ROOT, Value.of(false));
instanceReader.setSource(new DefaultInputSupplier(xmlLocation));
instanceReader.setSourceSchema(sourceSchema);
IOReport instanceReport = instanceReader.execute(null);
assertTrue(instanceReport.isSuccess());
return instanceReader.getInstances();
}
Aggregations