MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / parse

Method parse

packages/core/ui/builder/index.ts:601–627  ·  view source on GitHub ↗
(args: xml.ParserEvent)

Source from the content-addressed store, hash-verified

599 ) {}
600
601 public parse(args: xml.ParserEvent): XmlStateConsumer {
602 if (args.eventType === xml.ParserEventType.StartElement && args.elementName === 'template') {
603 const childParser = new TemplateParser(this, this.templateProperty, false);
604 childParser['key'] = args.attributes['key'];
605 this._childParsers.push(childParser);
606
607 return childParser;
608 }
609
610 if (args.eventType === xml.ParserEventType.EndElement) {
611 const name = ComponentParser.getComplexPropertyName(args.elementName);
612 if (name === this.templateProperty.name) {
613 const templates = new Array<KeyedTemplate>();
614 for (let i = 0; i < this._childParsers.length; i++) {
615 templates.push({
616 key: this._childParsers[i]['key'],
617 createView: this._childParsers[i].buildTemplate(),
618 });
619 }
620 this._value = templates;
621
622 return this.parent.parse(args);
623 }
624 }
625
626 return this;
627 }
628 }
629
630 export namespace TemplateParser {

Callers

nothing calls this directly

Calls 4

buildTemplateMethod · 0.80
parseMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected