Microsoft.XMLDOM

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
inseption86
Posts: 206
Joined: 19 Apr 2018, 00:24

Microsoft.XMLDOM

09 Jul 2022, 06:50

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<act contract="646" type="2">
   <tests>
      <test level="30">
         <people>
            <man is_retry="0" citizen="13" gender="f">
               <surname_lat>GURBANOVA</surname_lat>
               <name_lat>GARANFIL</name_lat>
               <passport_series>P</passport_series>
               <passport>3906597</passport>
               <passport_date>16.11.2009</passport_date>
               <migration_card_series>122</migration_card_series>
               <migration_card_number>332233</migration_card_number>
               <subtests>
                  <subtest num="1">2</subtest>
                  <subtest num="2">1</subtest>
                  <subtest num="3">3</subtest>
                  <subtest num="4">2</subtest>
                  <subtest num="5">4</subtest>
                  <subtest num="6">4</subtest>
               </subtests>
            </man>
         </people>
      </test>
   </tests>
</act>

Code: Select all

filePath := A_Desktop "\test.xml" 

xmlDoc := ComObjCreate("Microsoft.XMLDOM")
xmlDoc.load(filePath)

coll := xmlDoc.getElementsByTagName("people")
for item in coll
{
   vendor := item.getElementsByTagName("man").(0)
   vendor.removeChild(vendor)
}

MsgBox % xmlDoc.xml
ExitApp
Good afternoon, but how to copy the entire branch "man" ?
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Microsoft.XMLDOM

09 Jul 2022, 08:28

Code: Select all

vendor := xmlDoc.getElementsByTagName("man").item[0]
MsgBox % vendor.text
. "`n" vendor.getAttribute("is_retry")
. "`n" vendor.getAttribute("citizen")
. "`n" vendor.getAttribute("gender")
. "`n" vendor.selectSingleNode("name_lat").text

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: labrint, whoops and 122 guests