0

I would like to get the xmi:id of a UML2 element For example in my UML2 model I have a class named "Class1" corresponding to this portion of the XMI

<packagedElement xmi:type="uml:Class" xmi:id="_pEhskNd5EeGsNLQiqvGbrw" name="Class1">

how can I get id using the UML2 library? I know there is something like XMLResource and its have getId(EObject) but everytime its return me null

John
  • 363
  • 2
  • 6
  • 19
  • Your question is kind of unclear, but I suspect you are trying to parse some XMI. XMI is nothing more than an XML file. Its underlaying semantics (in this case UML model description) is relativelly irrelevant. Do you know how to parse XML? If so, you just need to know the exact format of the XMI and find the element you need. – Aleks Apr 10 '14 at 07:13
  • possible duplicate of [How to read XMI?](http://stackoverflow.com/questions/2304085/how-to-read-xmi) – PsiX Apr 11 '14 at 07:40

1 Answers1

0

you can try this

String xmiId = ((XMLResource) yourModel.eResource()).getID(yourClass) ;
David Buck
  • 3,752
  • 35
  • 31
  • 35
Tarek
  • 1