我正在尝试从我的XML文件中访问我的标记属性。但是,我所知道的是我做错了,但我不知道为什么,以及如何解决它
<extension
point="org.eclipse.emf.validation">
<constraintProvider
cache="true"
mode="Live">
<package
namespaceUri="http://mbse/project/yawlnets">
</package>
<constraints categories="org.pnml.tools.epnk.validation">
<constraint
id="model.project.validation.arc"
lang="OCL"
mode="Live"
name="Arc"
severity="ERROR"
statusCode="400">
<message>
</message>
<description>
</description>
<target
class="Arc:http://mbse/project/yawlnets">
<event
name="Set">
<feature
name="source">
</feature>
<feature
name="target">
</feature>
<feature
name="type">
</feature>
</event>
</target>
<![CDATA[
( self.source.oclIsKindOf(YAWLPlaces::PlaceTypes.END) and //HERE
self.target.oclIsKindOf(YAWLPlaces::PlaceTypes.START) and //HERE
self.type->size() = 0 )
]]>
</constraint>
</constraints>
</constraintProvider>
我已经评论了问题所在。 YAWLPlaces是我的java类,它有PlaceTypes的开始和结束
编辑:
private int getMarking(Place place) {
if (this.place instanceof Place) {
PlaceMarking marking = place.getMarking();
if (marking != null) {
switch (marking.getText().getValue()) {
case PlaceTypes.START_VALUE:
return 0;
case PlaceTypes.END_VALUE:
return 1;
}
}
}
return 2;
}