-rng.modules.visualEditor.transformations.fromXML = {
- getHTMLTree: function(xml) {
- return xml;
- },
- getMetaData: function(xml) {
- return {};
- },
- getDocumentDescription: function(xml) {
- return {
- HTMLTree: this.getHTMLTree(xml),
- metadata: this.getMetaData(xml)
+ var transformations = {};
+
+ transformations.fromXML = {
+ getHTMLTree: function(xml) {
+ return xml;
+ },
+ getMetaData: function(xml) {
+ var toret = {};
+ $(xml).find('metadata').children().each(function() {
+ var node = $(this);
+ toret[this.nodeName.split(':')[1].toLowerCase()] = node.text();
+ })
+ return toret;
+ },
+ getDocumentDescription: function(xml) {
+ return {
+ HTMLTree: this.getHTMLTree(xml),
+ metadata: this.getMetaData(xml)
+ }