Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PlatformFilter.prototype.parse = function (args) {
if (args.eventType === xml.ParserEventType.StartElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
if (this.currentPlatformContext) {
throw new Error("Already in '" + this.currentPlatformContext + "' platform context and cannot switch to '" + args.elementName + "' platform! Platform tags cannot be nested.");
}
this.currentPlatformContext = args.elementName;
return;
}
}
if (args.eventType === xml.ParserEventType.EndElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
this.currentPlatformContext = undefined;
return;
}
}
if (this.currentPlatformContext && !PlatformFilter.isCurentPlatform(this.currentPlatformContext)) {
return;
PlatformFilter.prototype.parse = function (args) {
if (args.eventType === xml.ParserEventType.StartElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
if (this.currentPlatformContext) {
throw new Error("Already in '" + this.currentPlatformContext + "' platform context and cannot switch to '" + args.elementName + "' platform! Platform tags cannot be nested.");
}
this.currentPlatformContext = args.elementName;
return;
}
}
if (args.eventType === xml.ParserEventType.EndElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
this.currentPlatformContext = undefined;
return;
}
}
if (this.currentPlatformContext && !PlatformFilter.isCurentPlatform(this.currentPlatformContext)) {
return;
}
this.next(args);
};
PlatformFilter.isPlatform = function (value) {
else if (parent.component._addChildFromBuilder) {
parent.component._addChildFromBuilder(args.elementName, componentModule.component);
}
}
else if (complexProperty) {
addToComplexProperty(parent, complexProperty, componentModule);
}
}
else if (parents.length === 0) {
rootComponentModule = componentModule;
}
parents.push(componentModule);
}
}
}
else if (args.eventType === xml.ParserEventType.EndElement) {
if (isComplexProperty(args.elementName)) {
if (complexProperty) {
if (parent && parent.component._addArrayFromBuilder) {
parent.component._addArrayFromBuilder(complexProperty.name, complexProperty.items);
complexProperty.items = [];
}
}
complexProperties.pop();
}
else {
parents.pop();
}
}
}, function (e) {
throw new Error("XML parse error: " + e.message);
PlatformFilter.prototype.parse = function (args) {
if (args.eventType === xml.ParserEventType.StartElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
if (this.currentPlatformContext) {
throw new Error("Already in '" + this.currentPlatformContext + "' platform context and cannot switch to '" + args.elementName + "' platform! Platform tags cannot be nested.");
}
this.currentPlatformContext = args.elementName;
return;
}
}
if (args.eventType === xml.ParserEventType.EndElement) {
if (PlatformFilter.isPlatform(args.elementName)) {
this.currentPlatformContext = undefined;
return;
}
}
if (this.currentPlatformContext && !PlatformFilter.isCurentPlatform(this.currentPlatformContext)) {
return;
}
this.next(args);
};
PlatformFilter.isPlatform = function (value) {
var xParser = new Xml.XmlParser(function (e) {
var c = currentContainer();
if (e.eventType === Xml.ParserEventType.StartElement) {
var newElement = new XElement(e.elementName);
newElement.add(e.data);
var attribs = getOwnProperties(e.attributes);
if (!TypeUtils.isNullOrUndefined(attribs)) {
for (var p in attribs) {
var a = new XAttribute(p);
a.value = attribs[p];
newElement.add(a);
}
}
currentContainer().add(newElement);
elementStack.push(newElement);
}
else if (e.eventType === Xml.ParserEventType.Text) {
var newText = new XText();
newText.value = e.data;
ComponentParser.prototype.parse = function (args) {
var parent = this.parents[this.parents.length - 1];
var complexProperty = this.complexProperties[this.complexProperties.length - 1];
if (args.eventType === xml.ParserEventType.StartElement) {
if (ComponentParser.isComplexProperty(args.elementName)) {
var name = ComponentParser.getComplexPropertyName(args.elementName);
this.complexProperties.push({
parent: parent,
name: name,
items: [],
});
if (ComponentParser.isKnownTemplate(name, parent.exports)) {
return new TemplateParser(this, {
context: (parent ? getExports(parent.component) : null) || this.context,
parent: parent,
name: name,
elementName: args.elementName,
templateItems: [],
errorFormat: this.error,
sourceTracker: this.sourceTracker
if (args.eventType === xml.ParserEventType.StartElement) {
templateBuilder.addStartElement(args.prefix, args.namespace, args.elementName, args.attributes);
}
else if (args.eventType === xml.ParserEventType.EndElement) {
if (templateBuilder.elementName !== args.elementName) {
templateBuilder.addEndElement(args.prefix, args.elementName);
}
else {
templateBuilder.build();
templateBuilder = undefined;
}
}
}
var parent = parents[parents.length - 1];
var complexProperty = complexProperties[complexProperties.length - 1];
if (args.eventType === xml.ParserEventType.StartElement) {
if (isComplexProperty(args.elementName)) {
var name = getComplexProperty(args.elementName);
complexProperties.push({
parent: parent,
name: name,
items: [],
});
if (templateBuilderDef.isKnownTemplate(name, parent.exports)) {
templateBuilder = new templateBuilderDef.TemplateBuilder({
parent: parent,
name: name,
elementName: args.elementName,
templateItems: []
});
}
}
if (args.eventType === xml.ParserEventType.StartElement) {
templateBuilder.addStartElement(args.prefix, args.namespace, args.elementName, args.attributes);
}
else if (args.eventType === xml.ParserEventType.EndElement) {
if (templateBuilder.elementName !== args.elementName) {
templateBuilder.addEndElement(args.prefix, args.elementName);
}
else {
templateBuilder.build();
templateBuilder = undefined;
}
}
}
var parent = parents[parents.length - 1];
var complexProperty = complexProperties[complexProperties.length - 1];
if (args.eventType === xml.ParserEventType.StartElement) {
if (isComplexProperty(args.elementName)) {
var name = getComplexProperty(args.elementName);
complexProperties.push({
parent: parent,
name: name,
items: [],
});
if (templateBuilderDef.isKnownTemplate(name, parent.exports)) {
templateBuilder = new templateBuilderDef.TemplateBuilder({
parent: parent,
name: name,
elementName: args.elementName,
templateItems: []
});
}
}
MultiTemplateParser.prototype.parse = function (args) {
if (args.eventType === xml.ParserEventType.StartElement && args.elementName === "template") {
var childParser = new TemplateParser(this, this.templateProperty, false);
childParser["key"] = args.attributes["key"];
this._childParsers.push(childParser);
return childParser;
}
if (args.eventType === xml.ParserEventType.EndElement) {
var name = ComponentParser.getComplexPropertyName(args.elementName);
if (name === this.templateProperty.name) {
var templates = new Array();
for (var i = 0; i < this._childParsers.length; i++) {
templates.push({
key: this._childParsers[i]["key"],
createView: this._childParsers[i]._build()
});
}
this.templateProperty.parent.component[this.templateProperty.name] = templates;
else if (parent.component._addChildFromBuilder) {
parent.component._addChildFromBuilder(args.elementName, componentModule.component);
}
}
else if (complexProperty) {
addToComplexProperty(parent, complexProperty, componentModule);
}
}
else if (parents.length === 0) {
rootComponentModule = componentModule;
}
parents.push(componentModule);
}
}
}
else if (args.eventType === xml.ParserEventType.EndElement) {
if (isComplexProperty(args.elementName)) {
if (complexProperty) {
if (parent && parent.component._addArrayFromBuilder) {
parent.component._addArrayFromBuilder(complexProperty.name, complexProperty.items);
complexProperty.items = [];
}
}
complexProperties.pop();
}
else {
parents.pop();
}
}
}, function (e) {
throw new Error("XML parse error: " + e.message);