templates_files.forEach(function(val, index, array) { var _ = val.split('.'); _.pop(); _ = _.join('.').split('/'); var name = _.pop(); var template_string = fs.readFileSync(val, {encoding: 'utf8'}); if(drop_spaces) { template_string = template_string.replace(/>\s+</g, '><'); } node(name, 'root', parser.parseFromString(template_string), collector); });
function linkifyNode(child, state) {try{ const {mutate} = state if(!child.data) return const data = XMLSerializer.serializeToString(child) if(/code/i.test(child.parentNode.tagName)) return if(/a/i.test(child.parentNode.tagName)) return const content = linkify(data, state.mutate, state.hashtags, state.usertags, state.images, state.links) if(mutate && content !== data) { child.parentNode.replaceChild(DOMParser.parseFromString(`<span>${content}</span>`), child) } } catch(error) {console.log(error)}}
it("Default indent - 2 spaces for attributes and 4 spaces for nested elements", function(){ var doc = parser.parseFromString("<doc a='1'><nested>text</nested></doc>"); var docCanon = "<doc\n" + " a=\"1\">\n" + " <nested>\n" + " text\n" + " </nested>\n" + "</doc>"; assert.equal(docCanon, canonize(doc)); });
it("grouping differences by source node XPath", function(){ var doc = parser.parseFromString("<doc attr1='1' attr2='2'><node1 attrX='y'><inner1 /></node1><node2><inner /></node2></doc>"); var doc2 = parser.parseFromString("<doc attr1='10'><node1 /><node2 /><extraNode /></doc>"); var failures = reporter.getDefferences(compare(doc, doc2)); assert.equal(3, Object.keys(failures).length); assert.equal(3, failures['/doc'].length); assert.equal(2, failures['/doc/node1'].length); assert.equal(1, failures['/doc/node2'].length); // check for results doplication failures = reporter.getDefferences(compare(doc, doc2)); assert.equal(3, Object.keys(failures).length); assert.equal(3, failures['/doc'].length); assert.equal(2, failures['/doc/node1'].length); assert.equal(1, failures['/doc/node2'].length); });
function embedYouTubeNode(child, links, images) { try { if(!child.data) return false const data = child.data const yt = youTubeId(data) if(!yt) return false const v = DOMParser.parseFromString(`~~~ embed:${yt.id} youtube ~~~`) child.parentNode.replaceChild(v, child) if(links) links.add(yt.url) if(images) images.add('https://img.youtube.com/vi/' + yt.id + '/0.jpg') return true } catch(error) { console.log(error); return false } }
it("Not found nodes reported", function(){ var doc1 = parser.parseFromString("<root>First<a />Second</root>"); var doc2 = parser.parseFromString("<root>First<a /></root>"); var result = compare(doc1, doc2, {}); var failures = result.getDifferences(); assert.equal(1, failures.length); assert.equal("Text node 'Second' is missed", failures[0].message); doc1 = parser.parseFromString("<root>First <a /> Second</root>"); doc2 = parser.parseFromString("<root> First<a /></root>"); result = compare(doc1, doc2, { stripSpaces: true }); failures = result.getDifferences(); assert.equal(1, failures.length); assert.equal("Text node 'Second' is missed", failures[0].message); });
it("Any leading/triling whitespace in text and comment nodes is trimmed", function(){ var doc = parser.parseFromString("<doc> test<elem> aaa </elem><!-- comment --></doc>"); var docCanon = "<doc>\n" + " test\n" + " <elem>\n" + " aaa\n" + " </elem>\n" + " <!--comment-->\n" + "</doc>"; assert.equal(docCanon, canonize(doc)); });
this.process = function(xmlFileAsString, callback, complete) { this.data = {} var numItems = 0; // console.log("processing:"); var parser = new DOMParser(); var xmlData = parser.parseFromString(xmlFileAsString,"text/xml"); var elements = xmlData.getElementsByTagName("message"); for(var m=0;m<elements.length;++m) { var text = elements[m].textContent; if(this.sizeLimit == null || text.length < this.sizeLimit) { var mid = elements[m].getAttribute("mid"); this.data[mid] = text.replace(/\\n/g, ' ').replace(/\n/g, ' ').replace(/#r/g, '').replace(/#Y/g, '').replace(/#y/g, '').replace(/#w/g, '').replace(/#j/g, '').replace(/#s/g, '').replace(/#j/g, '').replace(/#v/g, '').replace(/#g/g, ''); numItems++; } } callback('loaded ' + numItems + ' translations'); complete(); }
/** * Generate appx manifest properties * * <manifest>: * . May appear multiple times (target="phone" or target="store") * . When it doesn't have "target" that means common properties across phone & store * * Example: * <windows> * <manifest target="phone"> * <Capabilities> * <Capability Name="location" /> * </Capabilities> * </manifest> * <manifest target="store"> * <Capabilities> * <Capability Name="optical" /> * </Capabilities> * </manifest> * <manifest> * <Capabilities> * <Capability Name="internetClient" /> * </Capabilities> * </manifest> * </windows> */ function mergeAppxManifestForModule() { var _t = this; this.tiapp.windows.manifests = this.tiapp.windows.manifests || []; var domParser = new DOMParser(); for (var i = 0; i < this.modules.length; i++) { var timodule = path.join(this.modules[i].modulePath, 'timodule.xml'); if (fs.existsSync(timodule)) { var content = fs.readFileSync(timodule, 'utf8'), dom = domParser.parseFromString(content, 'text/xml'), root = dom.documentElement; appc.xml.forEachElement(root, function (node) { if (node.tagName == 'windows') { appc.xml.forEachElement(node, function (node) { if (node.tagName == 'manifest') { _t.tiapp.windows.manifests.push(node.toString()); } }); } }); } } }
data.replace(linksRe.youTube, url => { const match = url.match(linksRe.youTubeId) if(match && match.length >= 2) { const id = match[1] const v = DOMParser.parseFromString(`~~~ youtube:${id} ~~~`) child.parentNode.replaceChild(v, child) replaced = true if(links) links.add(url) if(images) images.add('https://img.youtube.com/vi/' + id + '/0.jpg') return } console.log("Youtube link without ID?", url); })
aquarius.onCommand(/^define (?<word>.+)$/i, async (message, { groups }) => { const check = aquarius.permissions.check( message.guild, ...info.permissions ); if (!check.valid) { log('Invalid permissions'); message.channel.send(aquarius.permissions.getRequestMessage(check.missing)); return; } aquarius.loading.start(message.channel); try { log(`Querying for '${groups.word}'`); const auth = `key=${process.env.DICTIONARY_API_KEY}`; const response = await fetch(`${API}/${groups.word}?${auth}`); const xml = await response.text(); const parser = new DOMParser(); const dom = parser.parseFromString(xml, 'text/xml'); const embed = new RichEmbed() .setTitle(capitalize(dom.getElementsByTagName('ew')[0].textContent)) .setColor(0x0074D9) .setFooter('Definitions provided by Merriam Webster') .addField('Definition', getDefinition(dom)) .addField('Plural', getPlural(dom)) .addField('Pronunciation', getPronunciation(dom)); message.channel.send(embed); analytics.trackUsage('define', message); } catch (err) { log(err); } aquarius.loading.stop(message.channel); });
this._request.call(null, url, function(err, res, data) { if (err) { return done(err); } try { var doc = parser.parseFromString(data); } catch (e) { return done(e); } var definition = doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "definitions"); if (!definition || definition.length !== 1) { return done(Error("couldn't find root definitions object")); } definition = definition[0]; var targetNamespace = definition.getAttribute("targetNamespace"); self.state.targetNamespace.push(targetNamespace); var i; var messages = definition.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "message"); for (i=0;i<messages.length;++i) { self.messages.push(self.messageFromXML(messages[i])); } var portTypes = definition.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "portType"); for (i=0;i<portTypes.length;++i) { self.portTypes.push(self.portTypeFromXML(portTypes[i])); } var bindings = definition.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "binding"); for (i=0;i<bindings.length;++i) { self.bindings.push(self.bindingFromXML(bindings[i])); } var services = definition.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "service"); for (i=0;i<services.length;++i) { self.services.push(self.serviceFromXML(services[i])); } self.state.targetNamespace.pop(); return done(); });
it("User can provide custom comparison routine, it can be used to extended reporting", function(){ var doc1 = parser.parseFromString("<root><a attr='10' /></root>"); var doc2 = parser.parseFromString("<root><a attr='20' /></root>"); var result = compare(doc1, doc2, { comparators: { ATTRIBUTE_NODE: function(e, a) { if(e.nodeValue > a.nodeValue) return "Actual value is less than expected"; else if(e.nodeValue < a.nodeValue) return "Actual value is greater than expected"; } } }); var failures = result.getDifferences(); assert.equal(1, failures.length); assert.equal("Actual value is greater than expected", failures[0].message); });
t.test('has valid links', function(t) { var baseURL = server.getBaseURL(); var select = xpath.useNamespaces({"atom": "http://www.w3.org/2005/Atom"}); var parser = new xmldom.DOMParser(); var doc = parser.parseFromString(atomBody, "text/xml"); async.eachSeries(["atom:feed/atom:link[not(@rel)]/@href", "atom:feed/atom:link[@rel='alternate']/@href", "atom:feed/atom:link[@rel='self']/@href", "atom:feed/atom:link[@rel='first']/@href", "atom:feed/atom:link[@rel='last']/@href" ], function(expression, done) { var results = select(expression, doc); t.equal(1, results.length); var href = results[0].nodeValue; var patched_href = href.replace(new RegExp("^https://oversight.garden"), baseURL); request(patched_href, function(error, response, body) { t.ifError(error); t.equal(200, response.statusCode); done(); }); }, t.end); });
data.replace(linksRe.youTube, url => { const match = url.match(linksRe.youTubeId) if(match && match.length >= 2) { const id = match[1] const src = `//www.youtube.com/embed/${id}?enablejsapi=0&rel=0&origin=https://steemit.com` const v = DOMParser.parseFromString(`<!--split--><div key="${id}" class="videoWrapper"> <iframe width="${large ? '640' : '384'}" height="${large ? 360 : 240}" src="${src}" frameBorder="0" allowFullScreen="true"></iframe> </div><!--split-->`) child.parentNode.replaceChild(v, child) replaced = true if(links) links.add(url) return } console.log("Youtube link without ID?", url); })
module.exports.transform = function (content, options) { var document = domParser.parseFromString(content); // move css to the top and combine it var imgNodes = document.getElementsByTagName("img"); if (imgNodes.length > 0) { for (var i = 0; i < imgNodes.length; i++) { var node = imgNodes[i]; node.setAttribute("data-original", node.getAttribute("src")); node.setAttribute("src", "/loader.gif"); } } return xmlSerializer.serializeToString(document.documentElement); };
fs.readFile('tests/test1.xml', {encoding: 'utf8'}, function(err, data) { if (err) { throw err; } else { test.notEqual(null, data); var dataString = data.toString(); test.notEqual(null, dataString); parser.parseFromString(dataString, 'application/xml'); } test.ifError(err); test.done(); });
module.exports = function(templates_files, as_module, drop_spaces /*> <*/){ if(!(templates_files instanceof Array)){ templates_files = [templates_files]; } var parser = new DOMParser(); var templates = {}; function collector(ins, source, arg1, arg2, arg3) { if(! templates.hasOwnProperty(source)) { templates[source] = []; } if(ins === 'node') { //Nodes go up templates[source].unshift([ins, arg1, arg2]); } else { // Other down templates[source].push([ins, arg1, arg2, arg3]); } } templates_files.forEach(function(val, index, array) { var _ = val.split('.'); _.pop(); _ = _.join('.').split('/'); var name = _.pop(); var template_string = fs.readFileSync(val, {encoding: 'utf8'}); if(drop_spaces) { template_string = template_string.replace(/>\s+</g, '><'); } node(name, 'root', parser.parseFromString(template_string), collector); }); var templates_code = []; for(var k in templates) { if(templates[k].length > 1) //Ignore stop instruction templates_code.push(k + ': function(pool){' + builder(templates[k]) + '}'); } if(as_module){ return 'module.exports = {' + templates_code.join(',') + '};'; } else { return '(function(window){' + 'var templates_list = {' + templates_code.join(',') + '};' + 'window.templates = temple_utils.pool(templates_list);' + '})(window);'; } };
function setNodeValue(node, value) { if (_.isFunction(value)) value = value(node, getNodeValue(node)); if (node.nodeType == ATTRIBUTE_NODE) { node.value = node.nodeValue = String(value); } else if (isCDataValue(value)) { clearChildNodes(node); node.appendChild(node.ownerDocument .createCDATASection(value.value)); } else if (isXmlString(value)) { clearChildNodes(node); node.appendChild(xmlParser.parseFromString(value.source)); } else { node.textContent = String(value); } }
function linkifyNode(child, state) {try{ const tag = child.parentNode.tagName ? child.parentNode.tagName.toLowerCase() : child.parentNode.tagName if(tag === 'code') return if(tag === 'a') return const {mutate} = state if(!child.data) return if(embedYouTubeNode(child, state.links, state.images)) return if(embedVimeoNode(child, state.links, state.images)) return const data = XMLSerializer.serializeToString(child) const content = linkify(data, state.mutate, state.hashtags, state.usertags, state.images, state.links) if(mutate && content !== data) { const newChild = DOMParser.parseFromString(`<span>${content}</span>`) child.parentNode.replaceChild(newChild, child) return newChild; } } catch(error) {console.log(error)}}
saxStream.on('match', function(xml) { if (exiting) { return; } // if (++count > 100) { // return; // } var xmlDOM = domParser.parseFromString(xml); var buildingId = xmlDOM.firstChild.getAttribute('gml:id') || UUID.v4(); var prefixedId; if (prefix) { prefixedId = prefix + buildingId; } // Skip building if already in streamed set redis.sismember('polygoncity:job:' + id + ':streamed_buildings', buildingId).then(function(result) { if (result === 1) { return; } // Append data onto job payload var newData = _.extend({}, data, { buildingId: (prefixedId) ? prefixedId : buildingId, buildingIdOriginal: buildingId, xml: xml }); // console.log(buildingId); // Add building to processing queue queue.create('repair_building_queue', newData).save(function() { // Add building ID to streamed buildings set redis.sadd('polygoncity:job:' + id + ':streamed_buildings', buildingId); // Increment building count redis.hincrby('polygoncity:job:' + id, 'buildings_count', 1); }); }); });
// wrap iframes in div.videoWrapper to control size/aspect ratio function iframe(state, child) { const url = child.getAttribute('src') if(url) { const {images, links} = state const yt = youTubeId(url) if(yt && images && links) { links.add(yt.url) images.add('https://img.youtube.com/vi/' + yt.id + '/0.jpg') } } const {mutate} = state if(!mutate) return const tag = child.parentNode.tagName ? child.parentNode.tagName.toLowerCase() : child.parentNode.tagName if(tag == 'div' && child.parentNode.getAttribute('class') == 'videoWrapper') return; const html = XMLSerializer.serializeToString(child) child.parentNode.replaceChild(DOMParser.parseFromString(`<div class="videoWrapper">${html}</div>`), child) }
module.exports = (file, cb) => { const contents = lang.trim(String(file.contents)); const doc = domParser.parseFromString(contents); if (doc && !(doc.childNodes.length === 1 && lang.isFunction(doc.firstChild.substringData))) { svgo.optimize(contents, result => { if (result.error) { console.log(doc); console.log(file.path, result.error); } else { file.contents = new Buffer(result.data); cb(null, file); } console.log(file.path); }); } else { cb(); console.log(`[ERROR FOUND]: ${file.path}`); } };
/** Embed videos, link mentions and hashtags, etc... */ export default function (html, {large = false, mutate = true}) { const state = {large, mutate} state.hashtags = new Set() state.usertags = new Set() state.images = new Set() state.links = new Set() try { const doc = DOMParser.parseFromString(html, 'text/html') traverse(doc, state) if(mutate) proxifyImages(doc) // console.log('state', state) if(!mutate) return state return {html: XMLSerializer.serializeToString(doc), ...state} }catch(error) { // Not Used, parseFromString might throw an error in the future console.error(error.toString()) return {html} } }
AIMLProcessor.prototype.recursEval = function (node) { if (node.nodeName == "#text") { return ValuePromise(node.nodeValue) } else if (node.nodeName == "#comment") { return ValuePromise("") } else if (node.nodeName == "template") { return this.evalTagContent( node ) } else if (node.nodeName == "random" ) { return this.random( node ) } else if (node.nodeName == "star") { return this.inputStar( node ) } else if (node.nodeName == "thatstar") { return this.thatStar( node ) } else if (node.nodeName == "topicstar") { return this.topicStar( node ) } else if (node.nodeName == "that") { return this.that( node ) } else if (node.nodeName == "input") { return this.input( node ) } else if (node.nodeName == "request") { return this.request( node ) } else if (node.nodeName == "response") { return this.response( node ) } else if (node.nodeName == "person") { return this.person(node) } else if (node.nodeName == "person2") { return this.person2(node) } else if (node.nodeName == "bot") { return this.botNode( node ) } else if (node.nodeName == "vocabulary") { return ValuePromise(this.bot.vocabulary.size) } else if (node.nodeName == "size") { return ValuePromise(this.bot.size) } else if (node.nodeName == "program") { return ValuePromise(Config.name + ' ' + Config.version) } else if (node.nodeName == "interval") { return this.interval(node) } else if (node.nodeName == "date") { return this.date(node) } else if (node.nodeName == "srai") { return this.srai(node) } else if (node.nodeName == "sr") { return this.srai(DOMParser.parseFromString("<srai>"+this.inputStars[0]+"</srai>").childNodes[0]) } else if (node.nodeName == "set") { return this.set(node) } else if (node.nodeName == "map") { return this.map(node) } else if (node.nodeName == "get") { return this.get(node) } else if (node.nodeName == "think") { return this.evalTagContent(node).then((res)=>{return""}); } else if (node.nodeName == "normalize") { return this.normalize(node) } else if (node.nodeName == "denormalize") { return this.denormalize(node) } else if (node.nodeName == "explode") { return this.explode(node) } else if (node.nodeName == "formal") { return this.formal(node) } else if (node.nodeName == "uppercase") { return this.uppercase(node) } else if (node.nodeName == "lowercase") { return this.lowercase(node) } else if (node.nodeName == "condition") { return this.loopCondition(node) } else if (node.nodeName == "learn") { return this.learn(node) } else if (node.nodeName == "first") { return this.first(node) } else if (node.nodeName == "rest") { return this.rest(node) } else if (node.nodeName == "sraix") { return this.sraix(node) } else if (node.nodeName == "javascript" ) { return this.jsTag(node) } else if (node.nodeName == "system" ) { return this.systemTag(node) } else { return this.unevaluatedXML(node) } }
nodes.forEach(function (node) { var value = getValue(node); grunt.verbose.writeln('setting value of "' + query + '" to "' + value + '"'); if (valueType === 'element') { node.textContent = ''; while (node.firstChild) { node.removeChild(node.firstChild); } node.appendChild(domParser.parseFromString(value)); } else if (valueType === 'remove') { var parentNode = node.parentNode; parentNode.removeChild(node); } else if (node.nodeType === ATTRIBUTE_NODE) { node.value = value; } else { node.textContent = value; } });
function embedVimeoNode(child, links, /*images*/) {try{ if(!child.data) return false const data = child.data let id { const m = data.match(linksRe.vimeoId) id = m && m.length >= 2 ? m[1] : null } if(!id) return false; const url = `https://player.vimeo.com/video/${id}` const v = DOMParser.parseFromString(`~~~ embed:${id} vimeo ~~~`) child.parentNode.replaceChild(v, child) if(links) links.add(url) // Preview image requires a callback.. http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo // if(images) images.add('https://.../vi/' + id + '/0.jpg') return true } catch(error) {console.log(error); return false}}
var citygmlPoints = function(xml) { var points = []; var xmlDOM = domParser.parseFromString(xml); // Only retreive the first posList // TODO: Decide if there's a need for supporting multiple posLists var pointsDOM = xmlDOM.getElementsByTagName("gml:posList")[0]; var coords; if (pointsDOM && pointsDOM.textContent.length > 0) { coords = pointsDOM.textContent.replace(poslistRegex, " ").trim().split(" "); } else { // Try gml:pos // This will return all gml:pos elements within a single array pointsDOM = xmlDOM.getElementsByTagName("gml:pos"); if (pointsDOM.length > 0) { coords = []; _.each(pointsDOM, function(posDOM) { coords.push(posDOM.textContent.trim().split(" ")); }); coords = _.flatten(coords); } } // TODO: Validate coordinate count against srsDimension var coordCount = coords.length; for (var i = 0; i < coordCount / 3; i++) { var index = i * 3; // [x, y, alt] points.push([Number(coords[index]), Number(coords[index + 1]), Number(coords[index + 2])]); } return points; };
function generateAppxManifest(next) { this.tiapp.windows = this.tiapp.windows || {}; this.readTiAppManifest(); this.mergeAppxManifestForModule(); var xprops = { phone: { '8.1': {}, '10.0': {} }, store: { '8.1': {}, '10.0': {} } }, domParser = new DOMParser(); if (this.tiapp.windows.manifests) { // Construct manifest properties for (var i = 0; i < this.tiapp.windows.manifests.length; i++) { var manifest = this.tiapp.windows.manifests[i]; var dom = domParser.parseFromString(manifest, 'text/xml'), root = dom.documentElement, target = appc.xml.getAttr(root, "target"), version = appc.xml.getAttr(root, "version"); appc.xml.forEachElement(root, function (node) { var key = node.tagName, elements = []; // gather all the child tags appc.xml.forEachElement(node, function (elm) { elements.push(elm); }); xprops.phone['8.1'][key] = xprops.phone['8.1'][key] || []; xprops.store['8.1'][key] = xprops.store['8.1'][key] || []; xprops.store['10.0'][key] = xprops.store['10.0'][key] || []; // If version is 10.0 or not specified, add it to store['10.0'] if (version == '10.0' || !version) { xprops.store['10.0'][key] = xprops.store['10.0'][key].concat(xprops.store['10.0'][key].concat(elements)); } // If version is 8.1 or not defined, check target to determine phone[8.1] and/or store[8.1] if (version == '8.1' || !version) { if (target == "phone") { xprops.phone['8.1'][key] = xprops.phone['8.1'][key].concat(xprops.phone['8.1'][key].concat(elements)); } else if (target == "store") { xprops.store['8.1'][key] = xprops.store['8.1'][key].concat(xprops.store['8.1'][key].concat(elements)); } else { xprops.phone['8.1'][key] = xprops.phone['8.1'][key].concat(xprops.phone['8.1'][key].concat(elements)); xprops.store['8.1'][key] = xprops.store['8.1'][key].concat(xprops.store['8.1'][key].concat(elements)); } } }); } } // TODO Only generate the manifest for the target we're building for! // TODO Write them out in parallel this.generateAppxManifestForPlatform("store", xprops.store['8.1']); this.generateAppxManifestForPlatform("phone", xprops.phone['8.1']); this.generateAppxManifestForPlatform("win10", xprops.store['10.0']); next(); };
/** * A URDF Model can be used to parse a given URDF into the appropriate elements. * * @constructor * @param options - object with following keys: * * xml - the XML element to parse * * string - the XML element to parse as a string */ function UrdfModel(options) { options = options || {}; var xmlDoc = options.xml; var string = options.string; this.materials = {}; this.links = {}; this.joints = {}; // Check if we are using a string or an XML element if (string) { // Parse the string var parser = new DOMParser(); xmlDoc = parser.parseFromString(string, 'text/xml'); } // Initialize the model with the given XML node. // Get the robot tag var robotXml = xmlDoc.documentElement; // Get the robot name this.name = robotXml.getAttribute('name'); // Parse all the visual elements we need for (var nodes = robotXml.childNodes, i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node.tagName === 'material') { var material = new UrdfMaterial({ xml : node }); // Make sure this is unique if (this.materials[material.name] !== void 0) { if( this.materials[material.name].isLink() ) { this.materials[material.name].assign( material ); } else { console.warn('Material ' + material.name + 'is not unique.'); } } else { this.materials[material.name] = material; } } else if (node.tagName === 'link') { var link = new UrdfLink({ xml : node }); // Make sure this is unique if (this.links[link.name] !== void 0) { console.warn('Link ' + link.name + ' is not unique.'); } else { // Check for a material for( var j=0; j<link.visuals.length; j++ ) { var mat = link.visuals[j].material; if ( mat !== null ) { if (this.materials[mat.name] !== void 0) { link.visuals[j].material = this.materials[mat.name]; } else { this.materials[mat.name] = mat; } } } // Add the link this.links[link.name] = link; } } else if (node.tagName === 'joint') { var joint = new UrdfJoint({ xml : node }); this.joints[joint.name] = joint; } } }