You are here:  » Unable to properly parse this xml file

Support Forum



Unable to properly parse this xml file

Submitted by Lukehymer on Sat, 2008-01-19 20:46 in

I have several pages to parse and one does not seems to be able to parse properly. If I use the demo on the site it working perfectly but not the actual downloaded version. It returns only the parts from "ITEMS" down. Not sure way.

Please help. Thanks.

<?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">
  <characterInfo>
    <character lastModified="January 13, 2008" suffix="" raceId="6" factionId="1" faction="Horde" name="Dizzyironbal" charUrl="r=Balnazzar&amp;n=Dizzyironbal" realm="Balnazzar" level="68" guildName="FoE" prefix="Legionnaire " guildUrl="r=Balnazzar&amp;n=FoE&amp;p=1" gender="Male" battleGroup="Rampage" race="Tauren" genderId="0" class="Warrior" classId="1"/>
    <characterTab>
      <talentSpec treeOne="8" treeThree="50" treeTwo="0"/>
      <buffs/>
      <debuffs/>
      <pvp>
        <lifetimehonorablekills value="13006"/>
        <arenacurrency value="0"/>
      </pvp>
      <professions>
        <skill key="alchemy" max="375" name="Alchemy" value="375"/>
        <skill key="herbalism" max="375" name="Herbalism" value="390"/>
      </professions>
      <title value="Legionnaire %s"/>
      <knownTitles>
        <title value="Legionnaire %s"/>
      </knownTitles>
      <characterBars>
        <health effective="9265"/>
        <secondBar casting="-1" effective="100" notCasting="-1" perFive="-1" type="r"/>
      </characterBars>
      <baseStats>
        <strength attack="762" base="159" block="19" effective="391"/>
        <agility armor="348" attack="-1" base="87" critHitPercent="6.86" effective="174"/>
        <stamina base="136" effective="523" health="5050" petBonus="-1"/>
        <intellect base="27" critHitPercent="-1.00" effective="27" mana="-1" petBonus="-1"/>
        <spirit base="52" effective="52" healthRegen="32" manaRegen="-1"/>
        <armor base="10201" effective="10201" percent="51.46" petBonus="-1"/>
      </baseStats>
      <resistances>
        <arcane petBonus="-1" value="18"/>
        <fire petBonus="-1" value="0"/>
        <frost petBonus="-1" value="10"/>
        <holy petBonus="-1" value="0"/>
        <nature petBonus="-1" value="10"/>
        <shadow petBonus="-1" value="0"/>
      </resistances>
      <melee>
        <mainHandDamage dps="129.6" max="311" min="234" percent="0" speed="2.10"/>
        <offHandDamage dps="0.0" max="0" min="0" percent="0" speed="2.00"/>
        <mainHandSpeed hastePercent="0.00" hasteRating="0" value="2.10"/>
        <offHandSpeed hastePercent="0.00" hasteRating="0" value="2.00"/>
        <power base="966" effective="990" increasedDps="70.0"/>
        <hitRating increasedHitPercent="4.95" value="70"/>
        <critChance percent="8.14" plusPercent="1.31" rating="26"/>
        <expertise additional="0" percent="1.50" rating="0" value="6"/>
      </melee>
      <ranged>
        <weaponSkill rating="0" value="208"/>
        <damage dps="101.7" max="295" min="213" percent="0" speed="2.50"/>
        <speed hastePercent="0.00" hasteRating="0" value="2.50"/>
        <power base="232" effective="256" increasedDps="18.0" petAttack="-1.00" petSpell="-1.00"/>
        <hitRating increasedHitPercent="4.95" value="70"/>
        <critChance percent="2.90" plusPercent="1.31" rating="26"/>
      </ranged>
      <spell>
        <bonusDamage>
          <arcane value="0"/>
          <fire value="0"/>
          <frost value="0"/>
          <holy value="0"/>
          <nature value="0"/>
          <shadow value="0"/>
          <petBonus attack="-1" damage="-1" fromType=""/>
        </bonusDamage>
        <bonusHealing value="0"/>
        <hitRating increasedHitPercent="0.00" value="0"/>
        <critChance rating="0">
          <arcane percent="0.00"/>
          <fire percent="0.00"/>
          <frost percent="0.00"/>
          <holy percent="0.00"/>
          <nature percent="0.00"/>
          <shadow percent="0.00"/>
        </critChance>
        <penetration value="0"/>
        <manaRegen casting="0.00" notCasting="0.00"/>
      </spell>
      <defenses>
        <armor base="10201" effective="10201" percent="51.46" petBonus="-1"/>
        <defense decreasePercent="2.56" increasePercent="2.56" plusDefense="44" rating="94" value="360.00"/>
        <dodge increasePercent="1.41" percent="10.77" rating="24"/>
        <parry increasePercent="0.99" percent="13.55" rating="21"/>
        <block increasePercent="0.00" percent="12.56" rating="0"/>
        <resilience damagePercent="0.96" hitPercent="0.48" value="17.00"/>
      </defenses>
      <items>
        <item durability="67" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_helmet_20" id="25589" maxDurability="70" permanentenchant="0" randomPropertiesId="0" seed="1955769528" slot="0"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_necklace_01" id="25067" maxDurability="0" permanentenchant="0" randomPropertiesId="-45" seed="1944453148" slot="1"/>
        <item durability="75" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shoulder_01" id="29316" maxDurability="80" permanentenchant="0" randomPropertiesId="0" seed="2100318325" slot="2"/>
        <item durability="126" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_chest_chain_07" id="25819" maxDurability="135" permanentenchant="0" randomPropertiesId="0" seed="1477288413" slot="4"/>
        <item durability="41" gem0Id="23095" gem1Id="23095" gem2Id="0" icon="inv_belt_27" id="24091" maxDurability="45" permanentenchant="0" randomPropertiesId="0" seed="1982716348" slot="5"/>
        <item durability="83" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_pants_plate_19" id="25011" maxDurability="85" permanentenchant="0" randomPropertiesId="-7" seed="1769799733" slot="6"/>
        <item durability="61" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_boots_plate_06" id="31232" maxDurability="65" permanentenchant="0" randomPropertiesId="-41" seed="1056768040" slot="7"/>
        <item durability="45" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_bracer_15" id="18754" maxDurability="45" permanentenchant="0" randomPropertiesId="0" seed="0" slot="8"/>
        <item durability="43" gem0Id="23095" gem1Id="23115" gem2Id="0" icon="inv_gauntlets_03" id="24387" maxDurability="45" permanentenchant="0" randomPropertiesId="0" seed="-1318448701" slot="9"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_ring_02" id="25775" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="1676285992" slot="10"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_ring_17" id="24151" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="630523548" slot="11"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_datacrystal06" id="28042" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="1795183594" slot="12"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_frostwolftrinket_05" id="17909" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="1981283454" slot="13"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_misc_cape_18" id="25780" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="202614166" slot="14"/>
        <item durability="81" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_sword_20" id="25772" maxDurability="90" permanentenchant="0" randomPropertiesId="0" seed="659417720" slot="15"/>
        <item durability="84" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shield_05" id="25081" maxDurability="85" permanentenchant="0" randomPropertiesId="-31" seed="971898908" slot="16"/>
        <item durability="75" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_weapon_rifle_05" id="25639" maxDurability="75" permanentenchant="0" randomPropertiesId="0" seed="542075135" slot="17"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shirt_guildtabard_01" id="5976" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="0" slot="18"/>
        <item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_misc_ammo_bullet_06" id="28061" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="0" slot="-1"/>
      </items>
    </characterTab>
  </characterInfo>
</page>

Submitted by support on Sat, 2008-01-19 20:51

Hello Luke,

This will be cause by the fact that the number of ITEM elements is confusing the auto-detection into thinking that it is the primary element. In the case of the example posted above, it looks like you are actually after each CHARACTERINFO record; in which case the format string required is:

xml|PAGE/CHARACTERINFO/

You can set this in your call to MagicParser_parse() (and if you know the format string it is always best to specify it rather than to rely on auto-detection) as follows:

  MagicParser_parse("data.xml","myRecordHandler","xml|PAGE/CHARACTERINFO/");

Cheers,
David.

Submitted by Lukehymer on Sat, 2008-01-19 21:01

Thanks for the promt attention. From your response I now understand the about the format string. I tried the solution and yes it works properly now.

Thanks again.