You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'm looking to create a pretty complicated XML, that includes about 8 namespaces. When I create a template, if I reference more than one namespace, I get the following error.....
/Users/dan/WebstormProjects/adiBuilder/node_modules/vash/lib/parser.js:108
var consumed = this[dispatch](this.node, curr, next, ahead, nnwon);
^
TypeError: undefined is not a function
at Parser.read (/Users/dan/WebstormProjects/adiBuilder/node_modules/vash/lib/parser.js:108:32)
at Object.exports.compile (/Users/dan/WebstormProjects/adiBuilder/node_modules/vash/index.js:62:33)
at Object.<anonymous> (/Users/dan/WebstormProjects/adiBuilder/app.js:30:16)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
This is before I include any variables/model or anything, seems to just fails parsing.
So, this works....
var tpl = vash.compile('<?xml version="1.0" encoding="UTF-8"?><ADI xmlns:core="http://www.cablelabs.com/namespaces/metadata/xsd/core/1" xmlns:ext="URN:NNDS:CMS:ADI3:01" xmlns="http://www.cablelabs.com/namespaces/metadata/xsd/vod30/1"><ext:title><AnotherElement>Hello</AnotherElement></ext:title></ADI>');
var out = tpl({});
var tpl = vash.compile('<?xml version="1.0" encoding="UTF-8"?><ADI xmlns:core="http://www.cablelabs.com/namespaces/metadata/xsd/core/1" xmlns:ext="URN:NNDS:CMS:ADI3:01" xmlns="http://www.cablelabs.com/namespaces/metadata/xsd/vod30/1"><ext:title><core:AnotherElement>Hello</core:AnotherElement></ext:title></ADI>');
var out = tpl({});
Vash is definitely not well prepared for XML. It's parser is well tested against html at the moment, but xml is new territory.
But I just pushed a fix (v0.11.0) that will solve the problem you were having. It was related to the colons in the namespaces: vash wasn't treating them as part of the tag name.
Hope this helps, and let me know if you run into more issues!
Hi there, I'm looking to create a pretty complicated XML, that includes about 8 namespaces. When I create a template, if I reference more than one namespace, I get the following error.....
This is before I include any variables/model or anything, seems to just fails parsing.
So, this works....
...and XML pretty printed...
And this does not work...
...and XML pretty printed...
Maybe Vash isn't the ideal tool for creating XMLs this way, any help is appreciated.
Dan
The text was updated successfully, but these errors were encountered: