Comments (3)
What DDEX spec and version are you working with? Most of this work is for the ERN v3.4. If you're dealing with ERN, what type of metadata are you trying to parse (music, video, software, ...)?
I think it could be ready to deal with ERN music metadata with a small amount of additional work, but this would be in a very basic manner (pre release), as there are some important underlying issues that need to be addressed. At this point I've put these off just to get through the grunt work of creating the class mappings (though they should be addressed now otherwise additional work could be counterproductive). They are:
DDEX versions
By this I mean different ERN versions (though support for all specs is the goal). Does one create a different namespace for each version?
doc = DDEX.read("metadata-4.0.xml") # returns DDEX::ERN::V40::NewReleaseMessage
doc = DDEX.read("metadata-3.2.xml") # returns DDEX::ERN::V32::NewReleaseMessage
Or just create a mapping that's capable of handling all versions in a single class?
Turning objects into valid XML
DDEX uses XML Schema and its sequence
directive to impose an order on the elements. How does one translate this order into the XML mapping? I'm using ROXML, which defaults to generating elements in the order in which they're declared. This is fine, but limits code reuse (or at least the approach to reusing code).
For example, ern:SoundRecording
differs from ddexC:SoundRecording
by 3 elements and 1 attribute. But if one makes ern:SoundRecording
a subclass of ddexC:SoundRecording
(which is currently the case) to_xml
could generate invalid XML as there's no guarantee that the schema will allow base class elements
to come before elements in their subclasses. This is also a potential downside to the namespace by version approach.
In this case I think that instead of using modules/classes to define behavior and relationships one would have to use modules to define helper methods that were then called in XSD sequence order when mapping a class:
class SoundRecoding < Element
include DDEX::SoundRecording::Accessors
xml_accessor :x
common_element_1
common_element_2
xml_accessor :y
end
Or, maybe it's better to define the XSD sequence order separately:
class SoundRecording
ELEMENT_ORDER = %w[x y z]
def to_xml
e = super
# need to account for Nokogiri and libxml elements
e.sort_by { |node| ELEMENT_ORDER.index(node.name) }
# etc...
end
end
So yeah, that's where I'm at. Help is definitely appreciated.
from ddex.
Closing this as things are somewhat more stable (still not production ready, though).
I still haven't generated and added all the DDEX specs to the lib, but doing so should now be trivial (see jaxb2ruby and the generate
Rake task). Let me know if you're using something that's not ERN and I'll try to add it.
from ddex.
@sshaw Thanks for your reply. Sorry to have gone radio silent but I am back on the DDEX bandwagon and should be working with your gem more frequently moving forward. I submitted a PR for an issue I encountered. Let me know if there is a flow you'd like me to follow. Thanks!
from ddex.
Related Issues (9)
- Add Tests for Checking DDEX.write()'s Output
- (Question) Are there any live public projects using this or open source projects implementing this library? HOT 4
- Invalid XML generation (wrong elements order) [ERN V3.2] HOT 3
- Support Rails 7 HOT 5
- Move CI from Travis ☠ to GitHub Actions or Whatever Else HOT 1
- Rename ERN 4.2 `Contributor#is_credited` to `credited?`
- Implementing DSR HOT 3
- ERN v312 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ddex.