| 542 | } |
| 543 | |
| 544 | private parseEndElement(prefix: string, elementName: string) { |
| 545 | if (this._state === TemplateParser.State.EXPECTING_START) { |
| 546 | throw new Error('Template must have exactly one root element but none was found.'); |
| 547 | } else if (this._state === TemplateParser.State.FINISHED) { |
| 548 | throw new Error('No more closing elements expected for this template.'); |
| 549 | } |
| 550 | |
| 551 | this._nestingLevel--; |
| 552 | |
| 553 | if (this._nestingLevel === 0) { |
| 554 | this._state = TemplateParser.State.FINISHED; |
| 555 | |
| 556 | if (this._setTemplateProperty && this._templateProperty.name in this._templateProperty.parent.component) { |
| 557 | const template = this.buildTemplate(); |
| 558 | this._templateProperty.parent.component[this._templateProperty.name] = template; |
| 559 | } |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | public buildTemplate(): Template { |
| 564 | if (__UI_USE_XML_PARSER__) { |