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

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

				var sLocalName = localName(xmlNode);
				if (xmlNode.namespaceURI === XHTML_NAMESPACE || xmlNode.namespaceURI === SVG_NAMESPACE) {
					// 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, false, false, pRequireContext);
					aResult.push("</" + sLocalName + ">");


				} else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === CORE_NAMESPACE) {
					// a Fragment element - which is not turned into a control itself. Only its content is parsed.
					parseChildren(xmlNode, false, true, pRequireContext);
					// 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, pRequireContext).then(function(aChildControls) {
							for (var i = 0; i < aChildControls.length; i++) {
								var oChild = aChildControls[i];

								// only views have a content aggregation
								if (oView.getMetadata().hasAggregation("content")) {
									// track extensionpoint information for root-level children of the view
									oView._epInfo = oView._epInfo || {
										contentControlsCount: 0,
										last: null,
										all: []
									};

									// child node is a placeholder for an ExtensionPoint
									// only in Flexibility scenario if an ExtensionProvider is given!
									if (oChild._isExtensionPoint) {
										oChild.index = oView._epInfo.contentControlsCount;
										oChild.targetControl = oView;
										oChild.aggregationName = "content";
										if (oView._epInfo.last) {
											oView._epInfo.last._nextSibling = oChild;
										}
										oView._epInfo.last = oChild;
										oView._epInfo.all.push(oChild);
									} else {
										// regular UI5 Controls can be added to the content aggregation directly
										oView._epInfo.contentControlsCount++;
										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
		 * @param {Promise} pRequireContext Promise which resolves with the loaded modules from require context
		 * @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 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
function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes, pRequireContext) {
			if ( xmlNode.nodeType === 1  ) {
				var sLocalName = localName(xmlNode);
				if (xmlNode.namespaceURI === XHTML_NAMESPACE || xmlNode.namespaceURI === SVG_NAMESPACE) {
					aResult.push("<" + sLocalName + " ");
					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(">");
					var oContent = xmlNode;
					if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) {
						oContent = xmlNode.content;
					}
					parseChildren(oContent, false, false, pRequireContext);
					aResult.push("</" + sLocalName + ">");
				} else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === CORE_NAMESPACE) {
					parseChildren(xmlNode, false, true, pRequireContext);
				} else {
					pResultChain = pResultChain.then(function() {
						return createControlOrExtension(xmlNode, pRequireContext).then(function(aChildControls) {
							for (var i = 0; i < aChildControls.length; i++) {
								var oChild = aChildControls[i];
								if (oView.getMetadata().hasAggregation("content")) {
									oView._epInfo = oView._epInfo || {
										contentControlsCount: 0,
										last: null,
										all: []
									};
									if (oChild._isExtensionPoint) {
										oChild.index = oView._epInfo.contentControlsCount;
										oChild.targetControl = oView;
										oChild.aggregationName = "content";
										if (oView._epInfo.last) {
											oView._epInfo.last._nextSibling = oChild;
										}
										oView._epInfo.last = oChild;
										oView._epInfo.all.push(oChild);
									} else {
										oView._epInfo.contentControlsCount++;
										oView.addAggregation("content", oChild);
									}
								} else if (oView.getMetadata().hasAssociation(("content"))) {
									oView.addAssociation("content", oChild);
								}
							}
							return aChildControls;
						});
					});
					aResult.push(pResultChain);
				}
			} else if (xmlNode.nodeType === 3  && !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 , pRequireContext ) { if ( xmlNode . nodeType === 1 ) { var sLocalName = localName ( xmlNode ) ; if ( xmlNode . namespaceURI === XHTML_NAMESPACE || xmlNode . namespaceURI === SVG_NAMESPACE ) { aResult . push ( "<" + sLocalName + " " ) ; 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 ( ">" ) ; var oContent = xmlNode ; if ( window . HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode . content instanceof DocumentFragment ) { oContent = xmlNode . content ; } parseChildren ( oContent , false , false , pRequireContext ) ; aResult . push ( "</" + sLocalName + ">" ) ; } else if ( sLocalName === "FragmentDefinition" && xmlNode . namespaceURI === CORE_NAMESPACE ) { parseChildren ( xmlNode , false , true , pRequireContext ) ; } else { pResultChain = pResultChain . then ( function ( ) { return createControlOrExtension ( xmlNode , pRequireContext ) . then ( function ( aChildControls ) { for ( var i = 0 ; i < aChildControls . length ; i ++ ) { var oChild = aChildControls [ i ] ; if ( oView . getMetadata ( ) . hasAggregation ( "content" ) ) { oView . _epInfo = oView . _epInfo || { contentControlsCount : 0 , last : null , all : [ ] } ; if ( oChild . _isExtensionPoint ) { oChild . index = oView . _epInfo . contentControlsCount ; oChild . targetControl = oView ; oChild . aggregationName = "content" ; if ( oView . _epInfo . last ) { oView . _epInfo . last . _nextSibling = oChild ; } oView . _epInfo . last = oChild ; oView . _epInfo . all . push ( oChild ) ; } else { oView . _epInfo . contentControlsCount ++ ; oView . addAggregation ( "content" , oChild ) ; } } else if ( oView . getMetadata ( ) . hasAssociation ( ( "content" ) ) ) { oView . addAssociation ( "content" , oChild ) ; } } return aChildControls ; } ) ; } ) ; aResult . push ( pResultChain ) ; } } else if ( xmlNode . nodeType === 3 && ! 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.
Parses an XML node that might represent a UI5 control or simple XHTML .
/* ELEMENT_NODE */ // write opening tag // write attributes // write children // <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes) // a Fragment element - which is not turned into a control itself. Only its content is parsed. // TODO: check if this branch is required or can be handled by the below one // assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name // 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. // only views have a content aggregation // track extensionpoint information for root-level children of the view // child node is a placeholder for an ExtensionPoint // only in Flexibility scenario if an ExtensionProvider is given! // regular UI5 Controls can be added to the content aggregation directly // can oView really have an association called "content"? /* TEXT_NODE */