Skip to content

Commit 999e86c

Browse files
committed
Merge pull request NativeScript#1291 from NativeScript/hdeshev/skip-default-namespace
Improve default XML namespace skips.
2 parents 9919eaf + 3e1b591 commit 999e86c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ui/builder/builder.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {Page} from "ui/page";
1111
import {resolveFileName} from "file-system/file-name-resolver";
1212
import * as traceModule from "trace";
1313

14+
const defaultNameSpaceMatcher = /tns\.xsd$/i;
15+
1416
export function parse(value: string | Template, context: any): View {
1517
if (isString(value)) {
1618
var viewToReturn: View;
@@ -196,7 +198,6 @@ namespace xml2ui {
196198
}, true);
197199

198200
if (isString(value)) {
199-
value = value.replace(/xmlns=("|')http:\/\/((www)|(schemas))\.nativescript\.org\/tns\.xsd\1/, "");
200201
xmlParser.parse(value);
201202
}
202203
}
@@ -456,7 +457,12 @@ namespace xml2ui {
456457
componentModule = loadCustomComponent(args.namespace, args.elementName, args.attributes, this.context, this.currentPage);
457458
} else {
458459
// Default components
459-
componentModule = getComponentModule(args.elementName, args.namespace, args.attributes, this.context);
460+
let namespace = args.namespace;
461+
if (defaultNameSpaceMatcher.test(namespace || '')) {
462+
//Ignore the default ...tns.xsd namespace URL
463+
namespace = undefined;
464+
}
465+
componentModule = getComponentModule(args.elementName, namespace, args.attributes, this.context);
460466
}
461467

462468
if (componentModule) {

0 commit comments

Comments
 (0)