@@ -32,10 +32,10 @@ function parseInternal(value: string, exports: any): componentBuilder.ComponentM
3232
3333 if ( templateBuilder ) {
3434 if ( args . eventType === xml . ParserEventType . StartElement ) {
35- templateBuilder . addStartElement ( args . elementName , args . attributes ) ;
35+ templateBuilder . addStartElement ( args . prefix , args . namespace , args . elementName , args . attributes ) ;
3636 } else if ( args . eventType === xml . ParserEventType . EndElement ) {
3737 if ( templateBuilder . elementName !== args . elementName ) {
38- templateBuilder . addEndElement ( args . elementName ) ;
38+ templateBuilder . addEndElement ( args . prefix , args . elementName ) ;
3939 } else {
4040 templateBuilder . build ( ) ;
4141 templateBuilder = undefined ;
@@ -72,35 +72,40 @@ function parseInternal(value: string, exports: any): componentBuilder.ComponentM
7272
7373 var componentModule : componentBuilder . ComponentModule ;
7474
75- if ( args . namespace ) {
75+ if ( args . prefix ) {
7676 // Custom components
77- var xmlPath = fs . path . join ( fs . knownFolders . currentApp ( ) . path , args . namespace , args . elementName ) + ".xml" ;
78- if ( fs . File . exists ( xmlPath ) ) {
79- // Custom components with XML
80- var jsPath = xmlPath . replace ( ".xml" , ".js" ) ;
81- var subExports ;
82- if ( fs . File . exists ( jsPath ) ) {
83- // Custom components with XML and code
84- subExports = require ( jsPath . replace ( ".js" , "" ) )
85- }
8677
87- componentModule = loadInternal ( xmlPath , subExports ) ;
78+ var ns = args . namespace ;
79+
80+ if ( ns ) {
81+ var xmlPath = fs . path . join ( fs . knownFolders . currentApp ( ) . path , ns , args . elementName ) + ".xml" ;
8882
89- // Attributes will be transfered to the custom component
90- if ( types . isDefined ( componentModule ) && types . isDefined ( componentModule . component ) ) {
91- var attr : string ;
92- for ( attr in args . attributes ) {
93- componentBuilder . setPropertyValue ( componentModule . component , subExports , exports , attr , args . attributes [ attr ] ) ;
83+ if ( fs . File . exists ( xmlPath ) ) {
84+ // Custom components with XML
85+ var jsPath = xmlPath . replace ( ".xml" , ".js" ) ;
86+ var subExports ;
87+ if ( fs . File . exists ( jsPath ) ) {
88+ // Custom components with XML and code
89+ subExports = require ( jsPath . replace ( ".js" , "" ) )
9490 }
95- }
9691
97- } else {
98- // Custom components without XML
99- componentModule = componentBuilder . getComponentModule ( args . elementName , args . namespace , args . attributes , exports ) ;
92+ componentModule = loadInternal ( xmlPath , subExports ) ;
93+
94+ // Attributes will be transfered to the custom component
95+ if ( types . isDefined ( componentModule ) && types . isDefined ( componentModule . component ) ) {
96+ var attr : string ;
97+ for ( attr in args . attributes ) {
98+ componentBuilder . setPropertyValue ( componentModule . component , subExports , exports , attr , args . attributes [ attr ] ) ;
99+ }
100+ }
101+ } else {
102+ // Custom components without XML
103+ componentModule = componentBuilder . getComponentModule ( args . elementName , ns , args . attributes , exports ) ;
104+ }
100105 }
101106 } else {
102107 // Default components
103- componentModule = componentBuilder . getComponentModule ( args . elementName , args . namespace , args . attributes , exports ) ;
108+ componentModule = componentBuilder . getComponentModule ( args . elementName , ns , args . attributes , exports ) ;
104109 }
105110
106111 if ( componentModule ) {
0 commit comments