How to use the xml.XmlParser 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 mkloubert / nativescript-apiclient / plugin / index.js View on Github external
contentConverter = function (c) {
                            c = convertToString(c);
                            if (null !== c) {
                                var isValidXml = true;
                                var xmlParser = new Xml.XmlParser(function () { }, function (error) {
                                    isValidXml = false;
                                });
                                xmlParser.parse(c);
                                if (!isValidXml) {
                                    throw "XML parse error.";
                                }
                            }
                            return c;
                        };
                        break;
github tjvantoll / nativescript-flashlight / demo / app / tns_modules / ui / builder / builder.js View on Github external
function parseInternal(value, exports) {
    var rootComponentModule;
    var parents = new Array();
    var complexProperties = new Array();
    var templateBuilder;
    var xmlParser = new xml.XmlParser(function (args) {
        if (templateBuilder) {
            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];
github NativeScript / summer-of-nativescript / august / DemoCode / app / tns_modules / ui / builder / builder.js View on Github external
function parseInternal(value, exports) {
    var rootComponentModule;
    var parents = new Array();
    var complexProperties = new Array();
    var templateBuilder;
    var xmlParser = new xml.XmlParser(function (args) {
        if (templateBuilder) {
            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];
github NativeScript / nativescript-marketplace-demo / app / tns_modules / ui / builder / builder.js View on Github external
function parseInternal(value, context) {
    var currentPage;
    var rootComponentModule;
    var parents = new Array();
    var complexProperties = new Array();
    var templateBuilder;
    var currentPlatformContext;
    var xmlParser = new xml.XmlParser(function (args) {
        if (args.eventType === xml.ParserEventType.StartElement) {
            if (isPlatform(args.elementName)) {
                if (currentPlatformContext) {
                    throw new Error("Already in '" + currentPlatformContext + "' platform context and cannot switch to '" + args.elementName + "' platform! Platform tags cannot be nested.");
                }
                currentPlatformContext = args.elementName;
                return;
            }
        }
        if (args.eventType === xml.ParserEventType.EndElement) {
            if (isPlatform(args.elementName)) {
                currentPlatformContext = undefined;
                return;
            }
        }
        if (currentPlatformContext && !isCurentPlatform(currentPlatformContext)) {
github mkloubert / nativescript-toolbox / plugin / xmlobjects / index.js View on Github external
function parse(xml, processNamespaces, angularSyntax) {
    var doc = new XDocument();
    var errors = [];
    var elementStack = [];
    var currentContainer = function () { return elementStack.length > 0 ? elementStack[elementStack.length - 1] : doc; };
    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) {
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
XmlStringParser.prototype.parse = function (value) {
            var _this = this;
            var xmlParser = new xml.XmlParser(function (args) {
                try {
                    _this.next(args);
                }
                catch (e) {
                    throw _this.error(e, args.position);
                }
            }, function (e, p) {
                throw _this.error(e, p);
            }, true);
            if (types_1.isString(value)) {
                xmlParser.parse(value);
            }
        };
        return XmlStringParser;
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
XmlStringParser.prototype.parse = function (value) {
            var _this = this;
            var xmlParser = new xml.XmlParser(function (args) {
                try {
                    _this.next(args);
                }
                catch (e) {
                    throw _this.error(e, args.position);
                }
            }, function (e, p) {
                throw _this.error(e, p);
            }, true);
            if (types_1.isString(value)) {
                xmlParser.parse(value);
            }
        };
        return XmlStringParser;
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / ui / builder / builder.js View on Github external
XmlStringParser.prototype.parse = function (value) {
            var _this = this;
            var xmlParser = new xml.XmlParser(function (args) {
                try {
                    _this.next(args);
                }
                catch (e) {
                    throw _this.error(e, args.position);
                }
            }, function (e, p) {
                throw _this.error(e, p);
            }, true);
            if (types_1.isString(value)) {
                xmlParser.parse(value);
            }
        };
        return XmlStringParser;