function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes) {

			if ( xmlNode.nodeType === 1 /* ELEMENT_NODE */ ) {

				var sLocalName = localName(xmlNode);
				if (xmlNode.namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode.namespaceURI === "http://www.w3.org/2000/svg") {
					// write opening tag
					aResult.push("<" + sLocalName + " ");
					// write attributes
					var bHasId = false;
					for (var i = 0; i < xmlNode.attributes.length; i++) {
						var attr = xmlNode.attributes[i];
						var value = attr.value;
						if (attr.name === "id") {
							bHasId = true;
							value = getId(oView, xmlNode);
						}
						aResult.push(attr.name + "=\"" + encodeXML(value) + "\" ");
					}
					if ( bRoot === true ) {
						aResult.push("data-sap-ui-preserve" + "=\"" + oView.getId() + "\" ");
						if (!bHasId) {
							aResult.push("id" + "=\"" + oView.getId() + "\" ");
						}
					}
					aResult.push(">");

					// write children
					var oContent = xmlNode;
					if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) {
						// <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes)
						oContent = xmlNode.content;
					}

					parseChildren(oContent);
					aResult.push("</" + sLocalName + ">");


				} else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === "sap.ui.core") {
					// a Fragment element - which is not turned into a control itself. Only its content is parsed.
					parseChildren(xmlNode, false, true);
					// TODO: check if this branch is required or can be handled by the below one

				} else {

					// assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name
					pResultChain = pResultChain.then(function() {
						// Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order).
						// The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible.
						return createControlOrExtension(xmlNode).then(function(aChildControls) {
							for (var i = 0; i < aChildControls.length; i++) {
							var oChild = aChildControls[i];
								if (oView.getMetadata().hasAggregation("content")) {
									oView.addAggregation("content", oChild);
								// can oView really have an association called "content"?
								} else if (oView.getMetadata().hasAssociation(("content"))) {
									oView.addAssociation("content", oChild);
								}
							}
							return aChildControls;
						});
					});
					aResult.push(pResultChain);

				}

			} else if (xmlNode.nodeType === 3 /* TEXT_NODE */ && !bIgnoreTopLevelTextNodes) {

				var text = xmlNode.textContent || xmlNode.text,
					parentName = localName(xmlNode.parentNode);
				if (text) {
					if (parentName != "style") {
						text = encodeXML(text);
					}
					aResult.push(text);
				}

			}
		}
function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes) {

			if ( xmlNode.nodeType === 1 /* ELEMENT_NODE */ ) {

				var sLocalName = localName(xmlNode);
				if (xmlNode.namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode.namespaceURI === "http://www.w3.org/2000/svg") {
					// write opening tag
					aResult.push("<" + sLocalName + " ");
					// write attributes
					var bHasId = false;
					for (var i = 0; i < xmlNode.attributes.length; i++) {
						var attr = xmlNode.attributes[i];
						var value = attr.value;
						if (attr.name === "id") {
							bHasId = true;
							value = getId(oView, xmlNode);
						}
						aResult.push(attr.name + "=\"" + encodeXML(value) + "\" ");
					}
					if ( bRoot === true ) {
						aResult.push("data-sap-ui-preserve" + "=\"" + oView.getId() + "\" ");
						if (!bHasId) {
							aResult.push("id" + "=\"" + oView.getId() + "\" ");
						}
					}
					aResult.push(">");

					// write children
					var oContent = xmlNode;
					if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) {
						// <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes)
						oContent = xmlNode.content;
					}

					parseChildren(oContent);
					aResult.push("</" + sLocalName + ">");


				} else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === "sap.ui.core") {
					// a Fragment element - which is not turned into a control itself. Only its content is parsed.
					parseChildren(xmlNode, false, true);
					// TODO: check if this branch is required or can be handled by the below one

				} else {

					// assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name
					pResultChain = pResultChain.then(function() {
						// Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order).
						// The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible.
						return createControlOrExtension(xmlNode).then(function(aChildControls) {
							for (var i = 0; i < aChildControls.length; i++) {
							var oChild = aChildControls[i];
								if (oView.getMetadata().hasAggregation("content")) {
									oView.addAggregation("content", oChild);
								// can oView really have an association called "content"?
								} else if (oView.getMetadata().hasAssociation(("content"))) {
									oView.addAssociation("content", oChild);
								}
							}
							return aChildControls;
						});
					});
					aResult.push(pResultChain);

				}

			} else if (xmlNode.nodeType === 3 /* TEXT_NODE */ && !bIgnoreTopLevelTextNodes) {

				var text = xmlNode.textContent || xmlNode.text,
					parentName = localName(xmlNode.parentNode);
				if (text) {
					if (parentName != "style") {
						text = encodeXML(text);
					}
					aResult.push(text);
				}

			}
		}
function parseNode ( xmlNode , bRoot , bIgnoreTopLevelTextNodes ) { if ( xmlNode . nodeType === 1 /* ELEMENT_NODE */ ) { var sLocalName = localName ( xmlNode ) ; if ( xmlNode . namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode . namespaceURI === "http://www.w3.org/2000/svg" ) { // write opening tag aResult . push ( "<" + sLocalName + " " ) ; // write attributes var bHasId = false ; for ( var i = 0 ; i < xmlNode . attributes . length ; i ++ ) { var attr = xmlNode . attributes [ i ] ; var value = attr . value ; if ( attr . name === "id" ) { bHasId = true ; value = getId ( oView , xmlNode ) ; } aResult . push ( attr . name + "=\"" + encodeXML ( value ) + "\" " ) ; } if ( bRoot === true ) { aResult . push ( "data-sap-ui-preserve" + "=\"" + oView . getId ( ) + "\" " ) ; if ( ! bHasId ) { aResult . push ( "id" + "=\"" + oView . getId ( ) + "\" " ) ; } } aResult . push ( ">" ) ; // write children var oContent = xmlNode ; if ( window . HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode . content instanceof DocumentFragment ) { // <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes) oContent = xmlNode . content ; } parseChildren ( oContent ) ; aResult . push ( "</" + sLocalName + ">" ) ; } else if ( sLocalName === "FragmentDefinition" && xmlNode . namespaceURI === "sap.ui.core" ) { // a Fragment element - which is not turned into a control itself. Only its content is parsed. parseChildren ( xmlNode , false , true ) ; // TODO: check if this branch is required or can be handled by the below one } else { // assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name pResultChain = pResultChain . then ( function ( ) { // Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order). // The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible. return createControlOrExtension ( xmlNode ) . then ( function ( aChildControls ) { for ( var i = 0 ; i < aChildControls . length ; i ++ ) { var oChild = aChildControls [ i ] ; if ( oView . getMetadata ( ) . hasAggregation ( "content" ) ) { oView . addAggregation ( "content" , oChild ) ; // can oView really have an association called "content"? } else if ( oView . getMetadata ( ) . hasAssociation ( ( "content" ) ) ) { oView . addAssociation ( "content" , oChild ) ; } } return aChildControls ; } ) ; } ) ; aResult . push ( pResultChain ) ; } } else if ( xmlNode . nodeType === 3 /* TEXT_NODE */ && ! bIgnoreTopLevelTextNodes ) { var text = xmlNode . textContent || xmlNode . text , parentName = localName ( xmlNode . parentNode ) ; if ( text ) { if ( parentName != "style" ) { text = encodeXML ( text ) ; } aResult . push ( text ) ; } } }
Parses an XML node that might represent a UI5 control or simple XHTML.
XHTML will be added to the aResult array as a sequence of strings,
UI5 controls will be instantiated and added as controls

@param {Element} xmlNode the XML node to parse
@param {boolean} bRoot whether this node is the root node
@param {boolean} bIgnoreTopLevelTextNodes
@returns {Promise} resolving with the content of the parsed node, which is a tree structure containing DOM Strings & UI5 Controls
Parses an XML node that might represent a UI5 control or simple XHTML . XHTML will be added to the aResult array as a sequence of strings UI5 controls will be instantiated and added as controls
Parses the given XML node.