Comparing version 0.4.24 to 0.4.25
@@ -303,2 +303,3 @@ /* | ||
/** | ||
@@ -320,3 +321,3 @@ * convert an xml element into a javascript object. | ||
// if there is text, there should be no children. | ||
if (elem.text.length > 0) { | ||
if (elem.text.length > 0 && elem.text.trim().length > 0) { | ||
var field = findField(elem.tag, def.fields); | ||
@@ -323,0 +324,0 @@ if (field) { |
@@ -14,3 +14,3 @@ { | ||
"description": "Serilization and Validation Framework for objects in RESTful APIs", | ||
"version": "0.4.24", | ||
"version": "0.4.25", | ||
"homepage": "https://github.com/racker/node-swiz", | ||
@@ -17,0 +17,0 @@ "repository": { |
@@ -1816,2 +1816,27 @@ /* | ||
exports['test_xml_with_whitespace'] = function(test, assert) { | ||
var validity = swiz.defToValve(def), | ||
v = new V(validity.Node), | ||
testxml, | ||
obj, sw = new swiz.Swiz(def); | ||
testxml = sw.deserializeXml('<?xml version="1.0" encoding="utf-8"?><node id="xkCD366" name="exmample"> <is_active>true</is_active><agent_name>your mom</agent_name><ipaddress>42.24.42.24</ipaddress></node>'); | ||
v.check(testxml, function(err, cleaned) { | ||
assert.ifError(err); | ||
obj = cleaned; | ||
obj.getSerializerType = function() {return 'Node';}; | ||
sw.serialize(swiz.SERIALIZATION.SERIALIZATION_XML, 1, obj, | ||
function(err, xml) { | ||
console.error(xml); | ||
assert.ifError(err); | ||
sw.deserialize(swiz.SERIALIZATION.SERIALIZATION_XML, 1, xml, function(err, newObj) { | ||
assert.deepEqual(newObj, exampleNode, 'Round trip json swiz/valve test'); | ||
assert.ifError(err); | ||
test.finish(); | ||
}); | ||
}); | ||
}); | ||
}; | ||
exports['test_boolean'] = function(test, assert) { | ||
@@ -1818,0 +1843,0 @@ var v = new V({ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
174098
5164