Mod Tool: Difference between revisions

341 bytes removed ,  27 June 2013
m
shorter
(scripting: read xml file (attribute/content-based))
m (shorter)
Line 943: Line 943:
  end if
  end if
  logmessage "-----------------------------------"
  logmessage "-----------------------------------"
  ' check for particle
  ' check for particle
  if element.childNodes(3).childNodes.length = 0 then
  if element.childNodes(3).childNodes.length = 0 then
logmessage "no particle present"
  logmessage "no particle present"
  else
  else
  logmessage "number of particle: " & element.childNodes(3).childNodes.length
  logmessage "number of particle: " & element.childNodes(3).childNodes.length
  for i = 0 to element.childNodes(3).childNodes.length - 1
  for each particle_section in element.childNodes(3).childNodes
' particle structure can vary
' http://wiki.oni2.net/XML:BINA/ONIE#particle_structures
' so we will count (=j) the nodes (xml tags) under <Particle> to build a loop
  logmessage "-----------------------------------"
  logmessage "-----------------------------------"
  for j = 0 to element.childNodes(3).childNodes(i).childNodes.length - 1
  for each particle_tag in particle_section.childnodes
' e.g.           <Particles>  <Particle>    <Name>
  logmessage particle_tag.nodename & ": " & particle_tag.text
  logmessage element.childNodes(3).childNodes(i).childNodes(j).nodename & ": " & _
  element.childNodes(3).childNodes(i).childNodes(j).text
  next
  next
  next
  next
8,452

edits