Shale is a Ruby object mapper and serializer for JSON, YAML, TOML, CSV and XML. It allows you to parse JSON, YAML, TOML, CSV and XML data and convert it into Ruby data structures, as well as serialize data structures into JSON, YAML, TOML, CSV or XML.
The way to solve this is to only apply the newer namespace on this particular Profile element. This means that all the 'uml' and 'xmi' element inside here need to be a different set of Ruby classes that inherit from the old version (2013).
e.g. uml:Profile contains ownedComment, packageImport, packagedElement etc.
Potential solution:
class Uml2016::OwnedComment < Uml2013::OwnedComment
xml do
# ...
namespace "http://www.omg.org/spec/UML/20161101", "uml"
end
end
class Uml2016::Profile < Shale::Mapper
attribute :owned_comment, Uml2016::OwnedComment
xml do
root 'Profile'
namespace "http://www.omg.org/spec/UML/20161101", "uml"
map_attribute `ownedComment`, to: :owned_comment
end
end
From:
Relates to:
7
Right now in the round-trip task, the
<profiles>
tag is entirely missing because:The
<uml:Profile>
tag uses:xmlns:uml="http://www.omg.org/spec/UML/20161101"
xmlns:xmi="http://www.omg.org/spec/XMI/20161101"
But the rest of the document uses:
xmlns:uml="http://www.omg.org/spec/UML/20131001"
xmlns:xmi="http://www.omg.org/spec/XMI/20131001"
The way to solve this is to only apply the newer namespace on this particular Profile element. This means that all the 'uml' and 'xmi' element inside here need to be a different set of Ruby classes that inherit from the old version (2013).
e.g.
uml:Profile
containsownedComment
,packageImport
,packagedElement
etc.Potential solution: