【发布时间】:2016-02-08 14:05:01
【问题描述】:
我在 xsd 中有以下类型:
<xs:complexType name="VendorSpecificType">
<xs:sequence>
<xs:any namespace="##any" processContents="skip" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
我在 Ecore 中创建了这种类型:
我尝试注入一个包含以下标签的 xml:
<VendorSpecific>
<Vendor ID="1"/>
</VendorSpecific>
但它崩溃了
org.eclipse.m2m.atl.core.ATLCoreException: Error loading test.xml: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'Vendor' not found.
用于在元模型中注入模型的代码已经过测试并且可以正常工作。 如果我删除 Vendor 标记,即使这个 test.xml 也会正确加载。
我的问题是如何将 xsd any 映射到 ecore 类型以便可以加载它?
更新:
经过调试,我用来将模型注入ecore模型的代码似乎不完整:extendedmetadata总是为null
// Load in metamodel
IReferenceModel metamodel = modelFactory.newReferenceModel();
injector.inject(metamodel, metamodelPath);
model = modelFactory.newModel(metamodel);
injector.inject(model, modelPath);
如何告诉它加载元数据?
【问题讨论】:
标签: xsd eclipse-emf-ecore