function validateXML(xmlString) {
		var tokens = tokenizeXML(xmlString);
		var currToken = '';
		var validXML = true;
		
		resetGlobalScope();

		// Verify there is not a mix of <> and &lt; &gt; characters
		if (xmlString.indexOf('<') > -1 && xmlString.indexOf('&lt;') > -1) {
			console.log('Invalid XML: xml string contains both < and &lt; characters.');
			return false;
		}
        if (xmlString.indexOf('>') > -1 && xmlString.indexOf('&gt;') > -1) {
            console.log('Invalid XML: xml string contains both > and &gt; characters.');
            return false;
        }

		// Verify that all the tags in the xml are properly closed
		for (var i = 0; i < tokens.length; i++) {
			currToken = tokens[i];
			if (isOpenTag(currToken)) {
				scopeDown(currToken)
			}
			else if (isCloseTag(currToken)) {
				if (getScope() !== getTagName(currToken)) {
					console.log("Malformed xml string -- " + getScope() + ': missing closing tag');
					return false;
				}
				scopeUp();
			}
			else if (isEmptyTag(currToken)) {
				// Do nothing, empty tag doesn't affect scope
			}
			else if (isValue(currToken)) {
				// Do nothing, values don't affect scope
			}
			else {
				console.log("Invalid token found: " + currToken);
				return false;
			}
		}

		resetGlobalScope();

		return validXML;
	}
/*
	*	Validates an xml string by checking the structure
	*	@param {String} xmlString - A properly formed xml string
	*	@return {Object} - true if the xml string is valid
	*	@throws
	*/
Validates an xml string by checking the structure
@param {String} xmlString - A properly formed xml string
@return {Object} - true if the xml string is valid
@throws
Validates an xml string by checking the structure @param { String } xmlString - A properly formed xml string @return { Object } - true if the xml string is valid @throws
function validateXML(xmlString) {
		var tokens = tokenizeXML(xmlString);
		var currToken = '';
		var validXML = true;
		resetGlobalScope();
		if (xmlString.indexOf('<') > -1 && xmlString.indexOf('&lt;') > -1) {
			console.log('Invalid XML: xml string contains both < and &lt; characters.');
			return false;
		}
        if (xmlString.indexOf('>') > -1 && xmlString.indexOf('&gt;') > -1) {
            console.log('Invalid XML: xml string contains both > and &gt; characters.');
            return false;
        }
		for (var i = 0; i < tokens.length; i++) {
			currToken = tokens[i];
			if (isOpenTag(currToken)) {
				scopeDown(currToken)
			}
			else if (isCloseTag(currToken)) {
				if (getScope() !== getTagName(currToken)) {
					console.log("Malformed xml string -- " + getScope() + ': missing closing tag');
					return false;
				}
				scopeUp();
			}
			else if (isEmptyTag(currToken)) {
			}
			else if (isValue(currToken)) {
			}
			else {
				console.log("Invalid token found: " + currToken);
				return false;
			}
		}
		resetGlobalScope();
		return validXML;
	}
function validateXML ( xmlString ) { var tokens = tokenizeXML ( xmlString ) ; var currToken = '' ; var validXML = true ; resetGlobalScope ( ) ; if ( xmlString . indexOf ( '<' ) > - 1 && xmlString . indexOf ( '&lt;' ) > - 1 ) { console . log ( 'Invalid XML: xml string contains both < and &lt; characters.' ) ; return false ; } if ( xmlString . indexOf ( '>' ) > - 1 && xmlString . indexOf ( '&gt;' ) > - 1 ) { console . log ( 'Invalid XML: xml string contains both > and &gt; characters.' ) ; return false ; } for ( var i = 0 ; i < tokens . length ; i ++ ) { currToken = tokens [ i ] ; if ( isOpenTag ( currToken ) ) { scopeDown ( currToken ) } else if ( isCloseTag ( currToken ) ) { if ( getScope ( ) !== getTagName ( currToken ) ) { console . log ( "Malformed xml string -- " + getScope ( ) + ': missing closing tag' ) ; return false ; } scopeUp ( ) ; } else if ( isEmptyTag ( currToken ) ) { } else if ( isValue ( currToken ) ) { } else { console . log ( "Invalid token found: " + currToken ) ; return false ; } } resetGlobalScope ( ) ; return validXML ; }
Validates an xml string by checking the structure
       @param {String} xmlString - A properly formed xml string
       @return {Object} - true if the xml string is valid
       @throws
Validates an xml string by checking the structure @param { String } xmlString - A properly formed xml string @return { Object } - true if the xml string is valid @throws
// Verify there is not a mix of <> and &lt; &gt; characters // Verify that all the tags in the xml are properly closed // Do nothing, empty tag doesn't affect scope // Do nothing, values don't affect scope