简体   繁体   中英

How to read an xmi file from rails?

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM