How to use the xml.ParserEventType function in xml

To help you get started, we’ve selected a few xml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bradyhouse / house / fiddles / nativeScript / fiddle-0009-SqliteDb / fifteenpuzzle / platforms / android / src / main / assets / app / tns_modules / ui / builder / builder.js View on Github external
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;
github bradyhouse / house / fiddles / nativeScript / fiddle-0001-PageNavigation / pagenavigation / platforms / android / build / intermediates / assets / F0 / debug / app / tns_modules / ui / builder / builder.js View on Github external
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) {
github NativeScript / summer-of-nativescript / august / DemoCode / app / tns_modules / ui / builder / builder.js View on Github external
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);
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / ui / builder / builder.js View on Github external
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) {
github mkloubert / nativescript-toolbox / plugin / xmlobjects / index.js View on Github external
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;
github bradyhouse / house / fiddles / nativeScript / fiddle-0001-PageNavigation / pagenavigation / platforms / android / build / intermediates / assets / F0 / debug / app / tns_modules / ui / builder / builder.js View on Github external
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
github NativeScript / nativescript-app-templates / packages / template-hello-world / tns_modules / ui / builder / builder.js View on Github external
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: []
                    });
                }
            }
github NativeScript / summer-of-nativescript / august / DemoCode / app / tns_modules / ui / builder / builder.js View on Github external
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: []
                    });
                }
            }
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / ui / builder / builder.js View on Github external
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;
github tjvantoll / nativescript-flashlight / demo / app / tns_modules / ui / builder / builder.js View on Github external
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);