From 955c8c0702512cabbdcbe296ae278f5e7ff2f497 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 30 Dec 2013 14:00:00 +0100 Subject: [PATCH 1/1] smartxml: raise an Error on invalid XML --- src/smartxml/smartxml.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index d42dcbf..acbe04d 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -222,7 +222,12 @@ $.extend(TextNode.prototype, { var parseXML = function(xml) { - return $($.trim(xml))[0]; + var toret = $($.trim(xml)); + if(!toret.length) { + throw new Error('Unable to parse XML: ' + xml); + } + return toret[0]; + }; var registerTransformation = function(desc, name, target) { -- 2.20.1