create xml using data from excel using macro -


here requirement - 1) have xml , corresponding xsd document 2) it's complex xml multiple elements , hierarchy. there elements/fields important 3) want create excel these fields user can enter data across multiple rows 4) when user clicks on create xml, separate xml should created each row 5) xml created should contain elements (user entered + many more in original xml)

this sample-

<a>    <a1/>    <a2/> </a> <b>    <b1>*user entered value*</b1>    <b2>*user entered value*</b2> </b> <c>    <c1/>    <c2/> </c> 

i found references on msxml2.domdocument60 1 can create xml using api , validate against schema through excel macro. in case there 1000s of tags. below options have in mind-

  1. use domdocument60 api , construct xml line line using macro. since there 1000s of tags, approach gulp 1000s of lines of code , make maintenance cumbersome task !
  2. since have sample xml, can empty existing values , update xml using user entered value (get excel cell data) through macro. seems more effective save 1000s of lines of code, possible ? since elements needs updated spread across xml, able search element , update element , not impact other data/tag in xml ?
  3. can done xsd ? none flashes mind requirement
  4. any other option ?

appreciate on this. !

if have base, can use that:

open "e:\0\xml.xml" input #1 open "e:\0\xml1.xml" output #2  = 1 while not eof(1)     line input #1, aa      if instr(1, aa, "<b1>", vbtextcompare) > 0         aa = left(aa, 3 + instr(1, aa, "<b1>", vbtextcompare)) & cells(i, 1).value & right(aa, len(aa) - instr(1, aa, "</b1>", vbtextcompare) + 1)         = + 1     end if      print #2, aa wend  close #1 close #2 

the code copy original file, changing text inside tag b1 values in column a.
if have more "pieces", can merge different files...


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -