c++ - 如何知道应该使用 C++ 中的适配器定义哪个 XSD 元素?
问题描述
<xsd:complexType name="Parallel">
<xsd:complexContent>
<xsd:extension base="otx:CompoundNode">
<xsd:sequence>
<xsd:element name="realisation" type="otx:ParallelRealisation" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
只需像上面那样发布一个 XSD 片段,我正在尝试将其生成为 C++ 代码,我必须定义一个用于描述 CompoundNode 类型的类,同时也是一个描述 Parallel 类型的类。而实际上,Parallel 类型的实例是这样的:
<CompoundNode xsi:type="Parallel">
...
在 C++ 代码中,我应该设计另一个类作为适配器,将基类 CompoundNode 转移到指定的子类(在我的 xsd 文件中确实有很多从 CompoundNode 派生的类),当然你可以说这只是多态性。
我的问题:当我不知道应该使用适配器类设计哪个基类时,XSD 架构中的规则是什么。
解决方案
推荐阅读
- python - 理解 Django 中的继承
- java - 方法的问题,我错过了什么吗?-> 该类型/类中的方法 foo 不适用于参数 ()
- r - 使用 taskscheduleR 设置环境变量进行调度
- c# - 尝试在同一控制器中的另一个操作方法中实例化模型类时获取空值
- python - 如何按时间间隔在python中对CSV文件进行排序
- java - Java如何使图形对象朝其面对的方向移动
- django - Setting requirepass on redis throws 'NOAUTH Authentication required'
- javascript - 使用 web-audio-api 的音高移位器?
- search - 如何在 Lua 脚本中查找文本
- php - 防止 PHP 中的“无代码”foreach 循环