How to read an xmi file from rails?

417 views Asked by At

I have several models saved in an xmi format. And I need to read them from some application in rails. I don't need to build a model from de xmi file, I just need to read some values that the xmi file has. Any ideas?

Thanks in advance!

1

There are 1 answers

0
davidb On

Read the file content and parse it at a hash:

fh=File.open("filename.xml", "r")
data=Hash.from_xml(fh.read)

This is just an example. All you need is the xml as a string and then you can use Hash.from_xml to parse it and work with it as a hash.