Hi,
I have a problem extracting the information I want from an EMF-model. I have created a meta-Model and from the model (.cim), expressed in XML, I want to generate code in the form of .mof (Managed Object Format). I therefore use XPath to extract information from the model and print it the way I like. But I can't seem to get the information I want...hopefully you can help me.
This is my simple CIM-model expressed in XML:
<?xml version="1.0" encoding="UTF-8"?>
<saabgroup:CModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:saabgroup="http://saabgroup.com/cim">
<namespace>
<classes xsi:type="saabgroup:CClass" name="aClass">
<qualifiers xsi:type="saabgroup:CClassConstraint" name="ClassConstraint">
<value>one</value>
<value>two</value>
</qualifiers>
<qualifiers xsi:type="saabgroup:CAbstract" name="Abstract" subclass="Restricted"/>
<qualifiers xsi:type="saabgroup:CDescription" name="Description" value="Desc.">
<translatable/>
</qualifiers>
</classes>
</namespace>
</saabgroup:CModel>
I want to extract the second value='two' from my first qualifier. Of what I have understood from XPath I tried the following:
<c:get select="/CModel/namespace/classes/qualifiers[1]/value[1]/text()">
But no result is returned. I have also tried many similar variants but everyone including text() fails. I did manage to get the first value from:
<c:get select="/CModel/namespace/classes/qualifiers[1]/@value">
But this implies that 'value' would be an attribute in the XML code, and I still can't get the second value. In the meta model value is expressed as a list of strings (For the qualifier of the type Description it is just a string).
Best regards
-Mats