Перенос части данных из 1 XML файла в другой

SZ
На сайте с 08.01.2011
Offline
78
254

Здравствуйте,

есть 2 практически идентичных XML файла, необходимо перенести часть данных из 1 XML файла в другой, с помощью софта, а не вручную, если это возможно.

Кратко файл 1:

                <Item Index="52" Name="Pantera Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="139" ReqLevel="380" DamageMin="26" DamageMax="34" AttackSpeed="40" Durability="95" MagicDurability="0" MagicPower="0" ReqStrength="78" ReqDexterity="25" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="0" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="2" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword37.bmd" />
                <Item Index="53" Name="Devast Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="149" ReqLevel="400" DamageMin="35" DamageMax="46" AttackSpeed="40" Durability="95" MagicDurability="0" MagicPower="0" ReqStrength="82" ReqDexterity="28" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="0" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="2" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword38.bmd" />
                <Item Index="54" Name="Darkangel Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="302" DamageMax="313" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="165" ReqDexterity="51" ReqEnergy="120" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="3" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="2" ModelPath="Data\Item\" ModelFile="DarkangelSword.bmd" />
                <Item Index="55" Name="Darkangel Magic Sword" Slot="0" SkillIndex="56" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="300" DamageMax="311" AttackSpeed="45" Durability="100" MagicDurability="0" MagicPower="118" ReqStrength="120" ReqDexterity="72" ReqEnergy="17" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="3" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="2" Overlap="0" NonValue="0" MasteryGrade="2" ModelPath="Data\Item\" ModelFile="DarkangelMagicsword.bmd" />
                <Item Index="56" Name="Darkangel Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="214" DamageMax="224" AttackSpeed="35" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="95" ReqDexterity="30" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="3" Overlap="0" NonValue="0" MasteryGrade="2" ModelPath="Data\Item\" ModelFile="sword39.bmd" />
                <Item Index="57" Name="Holyangel Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="365" DamageMax="376" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="152" ReqDexterity="47" ReqEnergy="111" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="3" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="3" ModelPath="Data\Item\" ModelFile="HolyAngelSword.bmd" />
                <Item Index="58" Name="Holyangel Magic Sword" Slot="0" SkillIndex="56" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="364" DamageMax="375" AttackSpeed="45" Durability="100" MagicDurability="0" MagicPower="125" ReqStrength="111" ReqDexterity="67" ReqEnergy="16" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="3" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="2" Overlap="0" NonValue="0" MasteryGrade="3" ModelPath="Data\Item\" ModelFile="HolyAngelMagicSword.bmd" />
                <Item Index="59" Name="Holyangel Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="277" DamageMax="287" AttackSpeed="35" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="88" ReqDexterity="28" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="3" Overlap="0" NonValue="0" MasteryGrade="3" ModelPath="Data\Item\" ModelFile="Sword40.bmd" />
                <Item Index="60" Name="Archangel Absolute Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="3" Serial="1" Option="1" Drop="0" DropLevel="100" ReqLevel="0" DamageMin="121" DamageMax="130" AttackSpeed="35" Durability="160" MagicDurability="0" MagicPower="0" ReqStrength="68" ReqDexterity="23" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="6" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword41.bmd" />
                <Item Index="61" Name="Blessed Arch's Absolute Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="3" Serial="1" Option="1" Drop="0" DropLevel="200" ReqLevel="0" DamageMin="136" DamageMax="147" AttackSpeed="35" Durability="160" MagicDurability="0" MagicPower="0" ReqStrength="60" ReqDexterity="22" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="8" Dump="0" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword42.bmd" />
                <Item Index="62" Name="Soul Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="200" ReqLevel="900" DamageMin="428" DamageMax="439" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="141" ReqDexterity="44" ReqEnergy="103" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="4" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="4" ModelPath="Data\Item\" ModelFile="soulknightsword.bmd" />

Кратко файл 2:

                <Item Index="52" Name="Pantera Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="139" ReqLevel="380" DamageMin="26" DamageMax="34" AttackSpeed="40" Durability="95" MagicDurability="0" MagicPower="0" ReqStrength="78" ReqDexterity="25" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="0" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="2" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword37.bmd" />
                <Item Index="53" Name="Devast Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="149" ReqLevel="400" DamageMin="35" DamageMax="46" AttackSpeed="40" Durability="95" MagicDurability="0" MagicPower="0" ReqStrength="82" ReqDexterity="28" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="0" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="2" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword38.bmd" />
                <Item Index="54" Name="Darkangel Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="302" DamageMax="313" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="165" ReqDexterity="51" ReqEnergy="120" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="3" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="DarkangelSword.bmd" />
                <Item Index="55" Name="Darkangel Magic Sword" Slot="0" SkillIndex="56" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="300" DamageMax="311" AttackSpeed="45" Durability="100" MagicDurability="0" MagicPower="118" ReqStrength="120" ReqDexterity="72" ReqEnergy="17" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="3" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="2" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="DarkangelMagicsword.bmd" />
                <Item Index="56" Name="Darkangel Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="160" ReqLevel="600" DamageMin="214" DamageMax="224" AttackSpeed="35" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="95" ReqDexterity="30" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword39.bmd" />
                <Item Index="57" Name="Holyangel Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="365" DamageMax="376" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="152" ReqDexterity="47" ReqEnergy="111" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="3" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="HolyAngelSword.bmd" />
                <Item Index="58" Name="Holyangel Magic Sword" Slot="0" SkillIndex="56" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="364" DamageMax="375" AttackSpeed="45" Durability="100" MagicDurability="0" MagicPower="125" ReqStrength="111" ReqDexterity="67" ReqEnergy="16" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="3" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="2" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="HolyAngelMagicSword.bmd" />
                <Item Index="59" Name="Holyangel Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="2" Serial="1" Option="1" Drop="0" DropLevel="180" ReqLevel="800" DamageMin="277" DamageMax="287" AttackSpeed="35" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="88" ReqDexterity="28" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="3" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="Sword40.bmd" />
                <Item Index="60" Name="Archangel Absolute Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="3" Serial="1" Option="1" Drop="0" DropLevel="100" ReqLevel="0" DamageMin="121" DamageMax="130" AttackSpeed="35" Durability="160" MagicDurability="0" MagicPower="0" ReqStrength="68" ReqDexterity="23" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="6" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword41.bmd" />
                <Item Index="61" Name="Blessed Arch's Absolute Claws" Slot="0" SkillIndex="270" TwoHand="0" Width="1" Height="3" Serial="1" Option="1" Drop="0" DropLevel="200" ReqLevel="0" DamageMin="136" DamageMax="147" AttackSpeed="35" Durability="160" MagicDurability="0" MagicPower="0" ReqStrength="60" ReqDexterity="22" ReqEnergy="0" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="0" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="1" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="8" Dump="0" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="1" KindB="3" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="sword42.bmd" />
                <Item Index="62" Name="Soul Sword" Slot="0" SkillIndex="22" TwoHand="0" Width="1" Height="4" Serial="1" Option="1" Drop="0" DropLevel="200" ReqLevel="900" DamageMin="428" DamageMax="439" AttackSpeed="40" Durability="100" MagicDurability="0" MagicPower="0" ReqStrength="141" ReqDexterity="44" ReqEnergy="103" ReqVitality="0" ReqCommand="0" SetAttrib="1" DarkWizard="0" DarkKnight="4" FairyElf="0" MagicGladiator="0" DarkLord="0" Summoner="0" RageFighter="0" GrowLancer="0" RuneWizard="0" Slayer="0" GunCrusher="0" Type="1" Dump="1" Transaction="1" PersonalStore="1" StoreWarehouse="1" SellToNPC="1" ExpensiveItem="1" Repair="1" KindA="14" KindB="1" Overlap="0" NonValue="0" MasteryGrade="0" ModelPath="Data\Item\" ModelFile="soulknightsword.bmd" />

Таких строк около 3 тысяч, в 1 файле MasteryGrade="" показатель есть 0, 1, 2, 3..7, в 2 файле MasteryGrade="" только 0. Мне нужно из файла 1 перенести все MasteryGrade="" в файл 2, в таком виде в каком они в файле 1.

Первая мысль была открыть оба файла в Excel, копировать столбец со значениями MasteryGrade из файла1 и заменить их в файле2, так и сделал, но Excel не экспортирует XML а выдаёт ошибку, либо при сохранении теряется структура файла.

Как-то можно это сделать не руками? 

Файл1 https://yadi.sk/d/6HZbmvRRgsr2Qg
Файл2 https://yadi.sk/d/di6HTJDs3M3u3g

temniy
На сайте с 15.03.2008
Offline
187
#1
можно написать скрипт на php или любом другом языке, который бы считывал оба  xml, заменял нужные данные и сохранял результат. 
⭐ продам - VYSOTSKIY.COM STOLITSA.INFO RUSSO-TURISTO.COM INTERNETBOOKS.RU TOURIZM.NET AVTOGONKA.COM METRDOTEL.COM SMOTRIKINO.COM PROCHARTER.RU и другие ⭐ Лучший хостинг от 1 евро, VPS от 5 евро -https://fornex.com/c/ffi2e3/ ⭐ 50 бесплатных смс - https://lcab.sms-uslugi.ru/r/registration

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий