+
+
+ },
+
+ registerClassTransformation: function(Transformation, className) {
+ var thisClassTransformations = (this.classTransformations[className] = this.classTransformations[className] || {});
+ thisClassTransformations[Transformation.prototype.name] = function() {
+ var nodeInstance = this;
+ var args = Array.prototype.slice.call(arguments, 0);
+ return nodeInstance.transform(Transformation, args);
+ };
+ },
+
+ registerClassMethod: function(methodName, method, className) {
+ var thisClassMethods = (this.classMethods[className] = this.classMethods[className] || {});
+ thisClassMethods[methodName] = method;
+ },
+
+ registerExtension: function(extension) {
+ smartxml.Document.prototype.registerExtension.call(this, extension);
+ var doc = this;
+
+ _.pairs(extension.wlxmlClass).forEach(function(pair) {
+ var className = pair[0],
+ classExtension = pair[1];
+
+ _.pairs(classExtension.methods || {}).forEach(function(pair) {
+ var name = pair[0],
+ method = pair[1];
+ doc.registerClassMethod(name, method, className);
+ });
+
+ _.pairs(classExtension.transformations || {}).forEach(function(pair) {
+ var name = pair[0],
+ desc = pair[1];
+ doc.registerClassTransformation(transformations.createContextTransformation(desc, name), className);
+ });
+ });
+