Как получить доступ к данным из файла XHTML и использовать их в программе Delphi - PullRequest
2 голосов
/ 22 августа 2010

В настоящее время я пишу приложение, которое должно извлекать данные из файла XHTML.

файл называется toon.xhtml и ниже его форматирование:

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="/_layout/character/sheet.xsl"?><page globalSearch="1" lang="en_us" requestUrl="/character-sheet.xml">

    <talentSpec group="1" icon="spell_holy_devotionaura" prim="Protection" treeOne="0" treeThree="14" treeTwo="57"/>
  </talentSpecs>
  <buffs/>
  <debuffs/>
  <pvp>
    <lifetimehonorablekills value="4217"/>
    <arenacurrency value="50"/>
  </pvp>
  <professions>

    <skill id="755" key="jewelcrafting" max="450" name="Jewelcrafting" value="450"/>
    <skill id="186" key="mining" max="450" name="Mining" value="450"/>
  </professions>
  <secondaryProfessions>
    <skill id="185" key="cooking" max="450" name="Cooking" value="450"/>
    <skill id="129" key="firstaid" max="450" name="First Aid" value="450"/>
    <skill id="356" key="fishing" max="450" name="Fishing" value="450"/>
    <skill id="762" key="riding" max="300" name="Riding" value="300"/>
  </secondaryProfessions>

  <characterBars>
    <health effective="43249"/>
    <secondBar casting="0" effective="5734" notCasting="21" type="m"/>
  </characterBars>
  <baseStats>
    <strength attack="3454" base="173" block="86" effective="1737"/>
    <agility armor="288" attack="-1" base="90" critHitPercent="6.03" effective="144"/>
    <stamina base="223" effective="3622" health="36040" petBonus="-1"/>
    <intellect base="98" critHitPercent="3.98" effective="108" mana="1340" petBonus="-1"/>

    <spirit base="108" effective="118" healthRegen="21" manaRegen="20"/>
    <armor base="29485" effective="31292" percent="67.26" petBonus="-1"/>
  </baseStats>
  <resistances>
    <arcane petBonus="-1" value="0"/>
    <fire petBonus="-1" value="0"/>
    <frost petBonus="-1" value="0"/>
    <holy petBonus="-1" value="0"/>
    <nature petBonus="-1" value="0"/>

    <shadow petBonus="-1" value="0"/>
  </resistances>
  <melee>
    <mainHandDamage dps="531.9" max="964" min="738" percent="0" speed="1.60"/>
    <offHandDamage dps="0.0" max="0" min="0" percent="0" speed="2.00"/>
    <mainHandSpeed hastePercent="0.00" hasteRating="0" value="1.60"/>
    <offHandSpeed hastePercent="0.00" hasteRating="0" value="2.00"/>
    <power base="3694" effective="3694" increasedDps="263.0"/>
    <hitRating increasedHitPercent="7.62" penetration="0" reducedArmorPercent="0.00" value="250"/>

    <critChance percent="15.03" plusPercent="0.00" rating="0"/>
    <expertise additional="4" percent="3.25" rating="36" value="13"/>
  </melee>
  <ranged>
    <weaponSkill rating="0" value="0"/>
    <damage dps="0.0" max="0" min="0" percent="0" speed="0.00"/>
    <speed hastePercent="0.00" hasteRating="0" value="0.00"/>
    <power base="134" effective="134" increasedDps="9.0" petAttack="-1.00" petSpell="-1.00"/>
    <hitRating increasedHitPercent="7.62" penetration="0" reducedArmorPercent="0.00" value="250"/>

    <critChance percent="15.03" plusPercent="0.00" rating="0"/>
  </ranged>
  <spell>
    <bonusDamage>
      <arcane value="1042"/>
      <fire value="1042"/>
      <frost value="1042"/>
      <holy value="1042"/>
      <nature value="1042"/>

      <shadow value="1042"/>
      <petBonus attack="-1" damage="-1" fromType=""/>
    </bonusDamage>
    <bonusHealing value="1042"/>
    <hitRating increasedHitPercent="9.53" penetration="0" reducedResist="0" value="250"/>
    <critChance rating="0">
      <arcane percent="12.98"/>
      <fire percent="12.98"/>
      <frost percent="12.98"/>

      <holy percent="12.98"/>
      <nature percent="12.98"/>
      <shadow percent="12.98"/>
    </critChance>
    <penetration value="0"/>
    <manaRegen casting="0.00" notCasting="21.00"/>
    <hasteRating hastePercent="0.00" hasteRating="0"/>
  </spell>
  <defenses>

    <armor base="29485" effective="31292" percent="67.26" petBonus="-1"/>
    <defense decreasePercent="6.48" increasePercent="6.48" plusDefense="162" rating="800" value="400.00"/>
    <dodge increasePercent="18.08" percent="30.45" rating="818"/>
    <parry increasePercent="9.81" percent="22.51" rating="444"/>
    <block increasePercent="2.26" percent="13.74" rating="37"/>
    <resilience damagePercent="0.00" hitPercent="0.00" value="0.00"/>
  </defenses>
  <items>
    <item displayInfoId="64630" durability="100" gem0Id="41380" gem1Id="40119" gem2Id="0" gemIcon0="inv_jewelcrafting_shadowspirit_02" gemIcon1="inv_jewelcrafting_gem_42" icon="inv_helmet_154" id="50862" level="251" maxDurability="100" name="Lightsworn Faceguard" permanentEnchantIcon="ability_warrior_swordandboard" permanentEnchantItemId="44878" permanentenchant="3818" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="0" slot="0"/>

    <item displayInfoId="64199" durability="0" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_jewelry_necklace_52" id="50763" level="251" maxDurability="0" name="Marrowgar's Scratching Choker" permanentenchant="0" pickUp="PickUpRing" putDown="PutDownRing" randomPropertiesId="0" rarity="4" seed="538689536" slot="1"/>
    <item displayInfoId="64622" durability="100" gem0Id="40119" gem1Id="40119" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" gemIcon1="inv_jewelcrafting_gem_42" icon="inv_shoulder_129" id="50003" level="264" maxDurability="100" name="Boneguard Commander's Pauldrons" permanentEnchantIcon="spell_holy_divinepurpose" permanentEnchantItemId="44136" permanentenchant="3811" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="1056180224" slot="2"/>
    <item displayInfoId="64569" durability="165" gem0Id="36767" gem1Id="40119" gem2Id="40119" gemIcon0="inv_jewelcrafting_dragonseye04" gemIcon1="inv_jewelcrafting_gem_42" gemIcon2="inv_jewelcrafting_gem_42" icon="inv_chest_plate_25" id="50024" level="264" maxDurability="165" name="Blightborne Warplate" permanentEnchantIcon="inv_scroll_03" permanentEnchantItemId="39005" permanentenchant="3297" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="973226912" slot="4"/>
    <item displayInfoId="64784" durability="55" gem0Id="40119" gem1Id="40119" gem2Id="36767" gemIcon0="inv_jewelcrafting_gem_42" gemIcon1="inv_jewelcrafting_gem_42" gemIcon2="inv_jewelcrafting_dragonseye04" icon="inv_belt_62" id="50036" level="264" maxDurability="55" name="Belt of Broken Bones" permanentenchant="0" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="1514889088" slot="5"/>
    <item displayInfoId="64848" durability="120" gem0Id="49110" gem1Id="40119" gem2Id="40119" gemIcon0="inv_misc_gem_pearl_12" gemIcon1="inv_jewelcrafting_gem_42" gemIcon2="inv_jewelcrafting_gem_42" icon="inv_pants_plate_32" id="49904" level="264" maxDurability="120" name="Pillars of Might" permanentEnchantIcon="inv_misc_armorkit_32" permanentEnchantItemId="38373" permanentenchant="3822" pickUp="PickUpMetalLArge" putDown="PutDownLArgeMEtal" randomPropertiesId="0" rarity="4" seed="1384778752" slot="6"/>
    <item displayInfoId="61372" durability="75" gem0Id="36767" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_dragonseye04" icon="inv_boots_plate_06" id="46997" level="245" maxDurability="75" name="Dawnbreaker Greaves" permanentEnchantIcon="inv_scroll_03" permanentEnchantItemId="38966" permanentenchant="1075" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="916620928" slot="7"/>
    <item displayInfoId="61897" durability="55" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_bracer_32a" id="47570" level="245" maxDurability="55" name="Saronite Swordbreakers" permanentEnchantIcon="inv_scroll_03" permanentEnchantItemId="44947" permanentenchant="3850" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="1490330752" slot="8"/>
    <item displayInfoId="64668" durability="55" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_gauntlets_85" id="51172" level="264" maxDurability="55" name="Sanctified Lightsworn Handguards" permanentEnchantIcon="inv_misc_armorkit_30" permanentEnchantItemId="38376" permanentenchant="3330" pickUp="PickUpLargeChain" putDown="PutDownLArgeChain" randomPropertiesId="0" rarity="4" seed="721673120" slot="9"/>
    <item displayInfoId="63959" durability="0" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_jewelry_ring_84" id="50404" level="277" maxDurability="0" name="Ashen Band of Endless Courage" permanentenchant="0" pickUp="PickUpMetalSmall" putDown="PutDownSmallMEtal" randomPropertiesId="0" rarity="4" seed="1048659648" slot="10"/>

    <item displayInfoId="64173" durability="0" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_jewelry_ring_84" id="50447" level="264" maxDurability="0" name="Harbinger's Bone Band" permanentenchant="0" pickUp="PickUpRing" putDown="PutDownRing" randomPropertiesId="0" rarity="4" seed="1446308096" slot="11"/>
    <item displayInfoId="64264" durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_misc_key_15" id="50356" level="264" maxDurability="0" name="Corroded Skeleton Key" permanentenchant="0" pickUp="PickUpWand" putDown="PutDownWand" randomPropertiesId="0" rarity="4" seed="0" slot="12"/>
    <item displayInfoId="64239" durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_misc_coin_18" id="50352" level="264" maxDurability="0" name="Corpse Tongue Coin" permanentenchant="0" pickUp="PickUpWand" putDown="PutDownWand" randomPropertiesId="0" rarity="4" seed="1924196992" slot="13"/>
    <item displayInfoId="64328" durability="0" gem0Id="40119" gem1Id="0" gem2Id="0" gemIcon0="inv_jewelcrafting_gem_42" icon="inv_misc_cape_13" id="50466" level="264" maxDurability="0" name="Sentinel's Winter Cloak" permanentEnchantIcon="inv_scroll_03" permanentEnchantItemId="44457" permanentenchant="1099" pickUp="PickUpCloth_Leather01" putDown="PutDownCloth_Leather01" randomPropertiesId="0" rarity="4" seed="0" slot="14"/>
    <item displayInfoId="64537" durability="105" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_sword_154" id="51010" level="251" maxDurability="105" name="The Facelifter" permanentEnchantIcon="inv_scroll_03" permanentEnchantItemId="46098" permanentenchant="3870" pickUp="PickUpMetalSmall" putDown="PutDownSmallMEtal" randomPropertiesId="0" rarity="4" seed="419699200" slot="15"/>
    <item displayInfoId="64409" durability="120" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shield_73" id="50794" level="251" maxDurability="120" name="Neverending Winter" permanentEnchantIcon="inv_shield_20" permanentEnchantItemId="35449" permanentenchant="1071" pickUp="PickUpMetalLArge" putDown="PutDownLArgeMEtal" randomPropertiesId="0" rarity="4" seed="993999648" slot="16"/>
    <item displayInfoId="64626" durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_offhand_ulduarraid_d_02" id="50461" level="264" maxDurability="0" name="Libram of the Eternal Tower" permanentenchant="0" pickUp="PickUpBook" putDown="PutDownBook" randomPropertiesId="0" rarity="4" seed="0" slot="17"/>
    <item displayInfoId="20621" durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shirt_guildtabard_01" id="5976" level="1" maxDurability="0" name="Guild Tabard" permanentenchant="0" pickUp="PickUpCloth_Leather01" putDown="PutDownCloth_Leather01" randomPropertiesId="0" rarity="1" seed="0" slot="18"/>
  </items>

  <glyphs>
    <glyph effect="Your Hammer of the Righteous hits 1 additional target." icon="ui-glyph-rune-8" id="702" name="Glyph of Hammer of the Righteous" type="major"/>
    <glyph effect="Damage against Undead increased by 1% while your Sense Undead ability is active." icon="ui-glyph-rune-9" id="456" name="Glyph of Sense Undead" type="minor"/>
    <glyph effect="Reduces the cooldown of your Lay on Hands spell by 5 min." icon="ui-glyph-rune-11" id="455" name="Glyph of Lay on Hands" type="minor"/>
    <glyph effect="While Divine Plea is active, you take 3% reduced damage from all sources." icon="ui-glyph-rune-1" id="705" name="Glyph of Divine Plea" type="major"/>
    <glyph effect="Reduces the mana cost of your Seal of Wisdom spell by 50%." icon="ui-glyph-rune-1" id="457" name="Glyph of the Wise" type="minor"/>
    <glyph effect="Your Seal of Vengeance or Seal of Corruption also grants 10 expertise while active." icon="ui-glyph-rune-15" id="561" name="Glyph of Seal of Vengeance" type="major"/>
  </glyphs>
</characterTab>

<summary>
  <c earned="492" points="5210" total="1058" totalPoints="11675"/>
  <category id="92" name="General">
    <c earned="39" earnedPoints="420" total="54" totalPoints="570"/>
  </category>
  <category id="96" name="Quests">
    <c earned="38" earnedPoints="380" total="49" totalPoints="530"/>
  </category>
  <category id="97" name="Exploration">

    <c earned="67" earnedPoints="770" total="70" totalPoints="830"/>
  </category>
  <category id="95" name="Player vs. Player">
    <c earned="39" earnedPoints="390" total="166" totalPoints="1930"/>
  </category>
  <category id="168" name="Dungeons &amp; Raids">
    <c earned="185" earnedPoints="1930" total="458" totalPoints="4955"/>
  </category>
  <category id="169" name="Professions">

    <c earned="45" earnedPoints="450" total="75" totalPoints="760"/>
  </category>
  <category id="201" name="Reputation">
    <c earned="22" earnedPoints="280" total="45" totalPoints="560"/>
  </category>
  <category id="155" name="World Events">
    <c earned="57" earnedPoints="590" total="141" totalPoints="1540"/>
  </category>
  <category id="81" name="Feats of Strength">

    <c earned="17"/>
  </category>
</summary>

Как я могу использовать данные вприложение Delphi, аналогичное тому, как я использовал бы наборы записей в BDE или ADO с подключением к MSSQL.Может быть, простой способ преобразовать его в файл XML и затем использовать его?

Ответы [ 2 ]

2 голосов
/ 23 августа 2010

XHTML-файлы являются XML-файлами. Вам не нужно конвертировать их вообще. Вы можете использовать любой стандартный анализатор XML для чтения файла XHTML.

Если ваша версия Delphi достаточно свежая, то у вас уже должен быть компонент TXmlDocument.

0 голосов
/ 22 августа 2010

Для чтения XML-файла и работы с ним я рекомендую использовать компонент NativeXML .Вы найдете полезные примеры на этом же сайте.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...