xml-to-json-stream
Version:
Simple module to convert XML to JSON with javascript
13 lines (9 loc) • 375 B
JavaScript
module.exports = function(tag) {
if((tag.charAt(0) === '<' && tag.charAt(1) === '?') && (tag.charAt(tag.length-1) === '>' && tag.charAt(tag.length-2) === '?')) {
return true;
}
if(tag.charAt(0) === '<' && (tag.charAt(tag.length-2)+tag.charAt(tag.length-1) === '/>' || tag.charAt(tag.length-1) === '>')) {
return true;
}
return false;
}