use of org.eclipse.persistence.sdo.helper.SDOXSDHelper in project metro-jax-ws by eclipse-ee4j.
the class SDOUtils method defineSchema.
// used by tests
public static List defineSchema(HelperContext hc, File f) throws Exception {
FileInputStream fin = null;
try {
fin = new FileInputStream(f);
InputStreamReader reader = new InputStreamReader(fin);
StreamSource source = new StreamSource(reader);
return ((SDOXSDHelper) hc.getXSDHelper()).define(source, null);
} finally {
if (fin != null) {
try {
fin.close();
} catch (IOException ioe) {
}
}
}
}
use of org.eclipse.persistence.sdo.helper.SDOXSDHelper in project eclipselink by eclipse-ee4j.
the class DeptServiceClientTestCases method defineXSD.
private void defineXSD() {
LOGGER.info("********** defineXSD() called **********");
try {
FileInputStream is = new FileInputStream(getSchemaName());
HelperContext ctx = HelperProvider.getDefaultContext();
SDOXSDHelper helper = (SDOXSDHelper) ctx.getXSDHelper();
helper.define(is, null);
} catch (Exception ioe) {
fail("An exception occurred while attempting to define schema [" + getSchemaName() + "]: " + ioe);
}
}
use of org.eclipse.persistence.sdo.helper.SDOXSDHelper in project eclipselink by eclipse-ee4j.
the class SDOResolvableTest method setUp.
@Override
public void setUp() {
try {
xmlComparer = new SDOXMLComparer();
aHelperContext = SDOHelperContext.getHelperContext();
typeHelper = aHelperContext.getTypeHelper();
xmlHelper = aHelperContext.getXMLHelper();
xsdHelper = aHelperContext.getXSDHelper();
equalityHelper = aHelperContext.getEqualityHelper();
copyHelper = aHelperContext.getCopyHelper();
dataFactory = aHelperContext.getDataFactory();
// TODO: we should be using the DataHelper interface
dataHelper = (SDODataHelper) aHelperContext.getDataHelper();
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
builderFactory.setIgnoringElementContentWhitespace(true);
try {
parser = builderFactory.newDocumentBuilder();
} catch (Exception e) {
fail("Could not create parser.");
e.printStackTrace();
}
((SDOTypeHelper) typeHelper).reset();
((SDOXMLHelper) xmlHelper).reset();
((SDOXSDHelper) xsdHelper).reset();
// load in the schema
String xsdString = getXSDString("org/eclipse/persistence/testing/sdo/helper/xmlhelper/PurchaseOrderDeep.xsd");
// Define Types so that processing attributes completes
List types = xsdHelper.define(xsdString);
// first we set up root data object
FileInputStream inStream = new FileInputStream("org/eclipse/persistence/testing/sdo/helper/xmlhelper/PurchaseOrderNSDeep.xml");
XMLDocument document = xmlHelper.load(inStream);
root = document.getRootObject();
inStream.close();
} catch (Exception e) {
e.printStackTrace();
fail("SDOResolvableTestCases.setup() failed to load DataObject");
}
}
use of org.eclipse.persistence.sdo.helper.SDOXSDHelper in project eclipselink by eclipse-ee4j.
the class EntityResolverTestCases method testResolveEntities.
public void testResolveEntities() {
ByteArrayInputStream bis = new ByteArrayInputStream(getSchema().getBytes());
((SDOXSDHelper) HelperProvider.getDefaultContext().getXSDHelper()).define(new StreamSource(bis), new SchemaEntityResolver());
}
use of org.eclipse.persistence.sdo.helper.SDOXSDHelper in project eclipselink by eclipse-ee4j.
the class LoadAndSaveIncludeWithExtensionTestCases method defineTypes.
@Override
protected List defineTypes() {
try {
String xsd = FILE_PROTOCOL + USER_DIR + "/org/eclipse/persistence/testing/sdo/helper/xmlhelper/includeWithExtension/WithInclude.xsd";
DefaultSchemaResolver sr = new DefaultSchemaResolver();
sr.setBaseSchemaLocation(getSchemaLocation());
return ((SDOXSDHelper) xsdHelper).define(new StreamSource(xsd), sr);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Aggregations