Apache Tuscany > Home > SDO CPP > Tuscany SDO - FAQ |
// Get hold of a helper context. This holds an XMLHelper instance HelperContext scope = SDOUtil.createHelperContext(); // Register all of the types we have generated into the HelperContext GenerateFactory.INSTANCE.register(scope); // A normal input stream to read the XML file fis = new FileInputStream("some.xml"); // Use the HelperContext to get and XMLHelper and use this to load the XML XMLDocument xmlDoc = scope.getXMLHelper().load(fis); // Now we have a document we can get the root object and cast it to the expected type GenerateType generateType = (GenerateType)xmlDoc.getRootObject();
There are some unit tests that show how to do this. You have to look in the tools tests cases as the Java static generator is in the tools project. Try looking in sdo\tools\src\test\java\org\apache\tuscany\sdo\test*.java.