function addObjectAtCurrentScope(token, json) {
		var tagObject = createObjectFromTag(token);
		var tmp = {};
		var i = 0;
		
		// If at the root scope, just add the tag object
		if (xmlScope.length === 1) {
			// If the object already exists, then create an array and put in there with the new tag object
			if (json[getScope()][getTagName(token)]) {
				addSameNameTagObject(token, tagObject, json);
			}
			else {
				json[getScope()][getTagName(token)] = tagObject;
			}

		}
		// Otherwise, navigate to the appropriate scope level in the object to add this new tag data
		else {
			
			tmp = json[xmlScope[0]];
			
			for (i = 1; i < xmlScope.length-1; i++) {
				tmp = tmp[xmlScope[i]];

				if (Array.isArray(tmp)) {
					tmp = tmp[tmp.length-1];
				}
			}

			if (Array.isArray(tmp)) {
				tmp = tmp[tmp.length-1];
			}

			// If there is an array of objects at this scope, the add this property to the last item in the array
			if (Array.isArray(tmp[getScope()])) {
				tmp = tmp[getScope()];
				if (Array.isArray(tmp)) {
					addSameNameTagObject(token, tagObject, tmp);
				}
				else {
					tmp[tmp.length-1][getTagName(token)] = tagObject;
				}
			}
			// If there is already an object with the same name at this location, create an array for it
			else if (tmp[getScope()][getTagName(token)]) {
				addSameNameTagObject(token, tagObject, tmp);
			}
			else {
				tmp[getScope()][getTagName(token)] = tagObject;
			}
		}
	}
/*
	*	Adds an object based off of a token to the current xml json object.  Location is determined by the global scope variable
	*	@param {String} token - An xml tag
	*	@param {object} json - the json object currently being built
	*/
Adds an object based off of a token to the current xml json object.  Location is determined by the global scope variable
@param {String} token - An xml tag
@param {object} json - the json object currently being built
Adds an object based off of a token to the current xml json object . Location is determined by the global scope variable @param { String } token - An xml tag @param { object } json - the json object currently being built
function addObjectAtCurrentScope(token, json) {
		var tagObject = createObjectFromTag(token);
		var tmp = {};
		var i = 0;
		if (xmlScope.length === 1) {
			if (json[getScope()][getTagName(token)]) {
				addSameNameTagObject(token, tagObject, json);
			}
			else {
				json[getScope()][getTagName(token)] = tagObject;
			}
		}
		else {
			tmp = json[xmlScope[0]];
			for (i = 1; i < xmlScope.length-1; i++) {
				tmp = tmp[xmlScope[i]];
				if (Array.isArray(tmp)) {
					tmp = tmp[tmp.length-1];
				}
			}
			if (Array.isArray(tmp)) {
				tmp = tmp[tmp.length-1];
			}
			if (Array.isArray(tmp[getScope()])) {
				tmp = tmp[getScope()];
				if (Array.isArray(tmp)) {
					addSameNameTagObject(token, tagObject, tmp);
				}
				else {
					tmp[tmp.length-1][getTagName(token)] = tagObject;
				}
			}
			else if (tmp[getScope()][getTagName(token)]) {
				addSameNameTagObject(token, tagObject, tmp);
			}
			else {
				tmp[getScope()][getTagName(token)] = tagObject;
			}
		}
	}
function addObjectAtCurrentScope ( token , json ) { var tagObject = createObjectFromTag ( token ) ; var tmp = { } ; var i = 0 ; if ( xmlScope . length === 1 ) { if ( json [ getScope ( ) ] [ getTagName ( token ) ] ) { addSameNameTagObject ( token , tagObject , json ) ; } else { json [ getScope ( ) ] [ getTagName ( token ) ] = tagObject ; } } else { tmp = json [ xmlScope [ 0 ] ] ; for ( i = 1 ; i < xmlScope . length - 1 ; i ++ ) { tmp = tmp [ xmlScope [ i ] ] ; if ( Array . isArray ( tmp ) ) { tmp = tmp [ tmp . length - 1 ] ; } } if ( Array . isArray ( tmp ) ) { tmp = tmp [ tmp . length - 1 ] ; } if ( Array . isArray ( tmp [ getScope ( ) ] ) ) { tmp = tmp [ getScope ( ) ] ; if ( Array . isArray ( tmp ) ) { addSameNameTagObject ( token , tagObject , tmp ) ; } else { tmp [ tmp . length - 1 ] [ getTagName ( token ) ] = tagObject ; } } else if ( tmp [ getScope ( ) ] [ getTagName ( token ) ] ) { addSameNameTagObject ( token , tagObject , tmp ) ; } else { tmp [ getScope ( ) ] [ getTagName ( token ) ] = tagObject ; } } }
Adds an object based off of a token to the current xml json object.
Adds an object based off of a token to the current xml json object .
// If at the root scope, just add the tag object // If the object already exists, then create an array and put in there with the new tag object // Otherwise, navigate to the appropriate scope level in the object to add this new tag data // If there is an array of objects at this scope, the add this property to the last item in the array // If there is already an object with the same name at this location, create an array for it