I have the following type in an xsd:
<xs:complexType name="VendorSpecificType">
<xs:sequence>
<xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
I created this type in Ecore:
I tried to inject an xml containing the following tags:
<VendorSpecific>
<Vendor ID="1"/>
</VendorSpecific>
But it crashes
org.eclipse.m2m.atl.core.ATLCoreException: Error loading test.xml: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'Vendor' not found.
The code used to inject models in metamodels is tested and working. Even this test.xml is loaded correctly if I remove the Vendor tag.
My question is how to map the xsd any to an ecore type so it can be loaded?
UPDATE:
After debugging, it seems that the code I use to inject the model into the ecore model is not complete: the extendedmetadata is always null
// Load in metamodel
IReferenceModel metamodel = modelFactory.newReferenceModel();
injector.inject(metamodel, metamodelPath);
model = modelFactory.newModel(metamodel);
injector.inject(model, modelPath);
How do I tell it to load the metadata?
I added the following line
((EMFModelFactory) modelFactory).getResourceSet().getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
before injecting the metamodel.
It works now!