mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #1291 from NativeScript/hdeshev/skip-default-namespace
Improve default XML namespace skips.
This commit is contained in:
@@ -11,6 +11,8 @@ import {Page} from "ui/page";
|
|||||||
import {resolveFileName} from "file-system/file-name-resolver";
|
import {resolveFileName} from "file-system/file-name-resolver";
|
||||||
import * as traceModule from "trace";
|
import * as traceModule from "trace";
|
||||||
|
|
||||||
|
const defaultNameSpaceMatcher = /tns\.xsd$/i;
|
||||||
|
|
||||||
export function parse(value: string | Template, context: any): View {
|
export function parse(value: string | Template, context: any): View {
|
||||||
if (isString(value)) {
|
if (isString(value)) {
|
||||||
var viewToReturn: View;
|
var viewToReturn: View;
|
||||||
@@ -196,7 +198,6 @@ namespace xml2ui {
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
if (isString(value)) {
|
if (isString(value)) {
|
||||||
value = value.replace(/xmlns=("|')http:\/\/((www)|(schemas))\.nativescript\.org\/tns\.xsd\1/, "");
|
|
||||||
xmlParser.parse(value);
|
xmlParser.parse(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -456,7 +457,12 @@ namespace xml2ui {
|
|||||||
componentModule = loadCustomComponent(args.namespace, args.elementName, args.attributes, this.context, this.currentPage);
|
componentModule = loadCustomComponent(args.namespace, args.elementName, args.attributes, this.context, this.currentPage);
|
||||||
} else {
|
} else {
|
||||||
// Default components
|
// Default components
|
||||||
componentModule = getComponentModule(args.elementName, args.namespace, args.attributes, this.context);
|
let namespace = args.namespace;
|
||||||
|
if (defaultNameSpaceMatcher.test(namespace || '')) {
|
||||||
|
//Ignore the default ...tns.xsd namespace URL
|
||||||
|
namespace = undefined;
|
||||||
|
}
|
||||||
|
componentModule = getComponentModule(args.elementName, namespace, args.attributes, this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (componentModule) {
|
if (componentModule) {
|
||||||
|
|||||||
Reference in New Issue
Block a user