src/parse-collada.js
function compactXML (res, xml) {
  var txt = Object.keys(xml.attributes).length === 0 && xml.children.length === 0
  var r = {}
  if (!res[xml.name]) res[xml.name] = []
  if (txt) {
    r = xml.content || ''
  } else {
    r.$ = xml.attributes
    r._ = xml.content || ''
    xml.children.forEach(function (ch) {
      compactXML(r, ch)
    })
  }
  res[xml.name].push(r)
  return res
}
function compactXML (res, xml) {
  var txt = Object.keys(xml.attributes).length === 0 && xml.children.length === 0
  var r = {}
  if (!res[xml.name]) res[xml.name] = []
  if (txt) {
    r = xml.content || ''
  } else {
    r.$ = xml.attributes
    r._ = xml.content || ''
    xml.children.forEach(function (ch) {
      compactXML(r, ch)
    })
  }
  res[xml.name].push(r)
  return res
}
function compactXML ( res , xml ) { var txt = Object . keys ( xml . attributes ) . length === 0 && xml . children . length === 0 var r = { } if ( ! res [ xml . name ] ) res [ xml . name ] = [ ] if ( txt ) { r = xml . content || '' } else { r . $ = xml . attributes r . _ = xml . content || '' xml . children . forEach ( function ( ch ) { compactXML ( r , ch ) } ) } res [ xml . name ] . push ( r ) return res }
We used to use a different XML parsing library. This recursively transforms
the data that we get from our new XML parser to match the old one. This is a
stopgap measure until we get around to changing the keys that we look while we parse to
the keys that the new parser expects
We used to use a different XML parsing library . This recursively transforms the data that we get from our new XML parser to match the old one . This is a stopgap measure until we get around to changing the keys that we look while we parse to the keys that the new parser expects