Foros del Web » Programando para Internet » PHP »

Lectura xml

Estas en el tema de Lectura xml en el foro de PHP en Foros del Web. Hola a todos, estoy intentado leer un documento xml en mi servidor que tiene estos datos Código PHP: < page globalSearch = "1"  lang = "en_us"  ...
  #1 (permalink)  
Antiguo 09/03/2009, 08:38
 
Fecha de Ingreso: mayo-2005
Mensajes: 94
Antigüedad: 18 años, 11 meses
Puntos: 0
Lectura xml

Hola a todos, estoy intentado leer un documento xml en mi servidor que tiene estos datos
Código PHP:
<page globalSearch="1" lang="en_us" requestUrl="/character-sheet.xml">
  <
characterInfo>
    <
character battleGroup="Crueldad" charUrl="r=Dun+Modr&amp;n=Wallstun" class="Hunter" classId="3" faction="Alliance" factionId="0" gender="Female" genderId="1" guildName="LUMINIS CRUOR" guildUrl="r=Dun+Modr&amp;n=LUMINIS+CRUOR&amp;p=1" lastModified="March 7, 2009" level="70" name="Wallstun" points="765" prefix="" race="Night Elf" raceId="4" realm="Dun Modr" suffix=""/>
    <
characterTab>
      <
talentSpec treeOne="1" treeThree="0" treeTwo="60"/>
      <
buffs/>
      <
debuffs/>
      <
pvp>
        <
lifetimehonorablekills value="3821"/>
        <
arenacurrency value="0"/>
      </
pvp>
      <
professions>
        <
skill key="leatherworking" max="450" name="Leatherworking" value="367"/>
        <
skill key="skinning" max="450" name="Skinning" value="391"/>
      </
professions>
      <
title value=""/>
      <
knownTitles/>
      <
characterBars>
        <
health effective="7398"/>
        <
secondBar casting="6" effective="5923" notCasting="59" type="m"/>
      </
characterBars>
      <
baseStats>
        <
strength attack="51" base="61" block="-1" effective="61"/>
        <
agility armor="1112" attack="546" base="162" critHitPercent="12.37" effective="556"/>
        <
stamina base="107" effective="401" health="3830" petBonus="120"/>
        <
intellect base="80" critHitPercent="5.95" effective="188" mana="2540" petBonus="-1"/>
        <
spirit base="83" effective="83" healthRegen="14" manaRegen="53"/>
        <
armor base="5388" effective="5388" percent="33.79" petBonus="1886"/>
      </
baseStats>
      <
resistances>
        <
arcane petBonus="0" value="0"/>
        <
fire petBonus="0" value="0"/>
        <
frost petBonus="0" value="0"/>
        <
holy petBonus="0" value="0"/>
        <
nature petBonus="0" value="0"/>
        <
shadow petBonus="0" value="0"/>
      </
resistances>
      <
melee>
        <
mainHandDamage dps="184.4" max="365" min="291" percent="0" speed="1.78"/>
        <
offHandDamage dps="102.8" max="199" min="167" percent="0" speed="1.78"/>
        <
mainHandSpeed hastePercent="1.27" hasteRating="20" value="1.78"/>
        <
offHandSpeed hastePercent="1.27" hasteRating="20" value="1.78"/>
        <
power base="737" effective="1619" increasedDps="115.0"/>
        <
hitRating increasedHitPercent="4.57" penetration="0" reducedArmorPercent="0.00" value="72"/>
        <
critChance percent="21.35" plusPercent="3.99" rating="88"/>
        <
expertise additional="3" percent="0.75" rating="15" value="3"/>
      </
melee>
      <
ranged>
        <
weaponSkill rating="0" value="0"/>
        <
damage dps="291.2" max="857" min="694" percent="0" speed="2.66"/>
        <
speed hastePercent="1.27" hasteRating="20" value="2.66"/>
        <
power base="874" effective="1756" increasedDps="125.0" petAttack="386.32" petSpell="226.00"/>
        <
hitRating increasedHitPercent="4.57" penetration="0" reducedArmorPercent="0.00" value="72"/>
        <
critChance percent="26.35" plusPercent="3.99" rating="88"/>
      </
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="5.71" penetration="0" reducedResist="0" value="72"/>
        <
critChance rating="88">
          <
arcane percent="9.94"/>
          <
fire percent="9.94"/>
          <
frost percent="9.94"/>
          <
holy percent="9.94"/>
          <
nature percent="9.94"/>
          <
shadow percent="9.94"/>
        </
critChance>
        <
penetration value="0"/>
        <
manaRegen casting="6.00" notCasting="59.00"/>
        <
hasteRating hastePercent="1.27" hasteRating="20"/>
      </
spell>
      <
defenses>
        <
armor base="5388" effective="5388" percent="33.79" petBonus="1886"/>
        <
defense decreasePercent="0.00" increasePercent="0.00" plusDefense="0" rating="0" value="350.00"/>
        <
dodge increasePercent="0.00" percent="9.28" rating="0"/>
        <
parry increasePercent="0.00" percent="5.00" rating="0"/>
        <
block increasePercent="0.00" percent="0.00" rating="0"/>
        <
resilience damagePercent="4.52" hitPercent="2.05" value="81.00"/>
      </
defenses>
      <
items>
        <
item durability="48" gem0Id="0" gem1Id="24028" gem2Id="0" icon="inv_helmet_09" id="31962" maxDurability="85" permanentenchant="3329" randomPropertiesId="0" seed="0" slot="0"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_necklace_38" id="34679" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="0" slot="1"/>
        <
item durability="45" gem0Id="24028" gem1Id="24048" gem2Id="0" icon="inv_shoulder_29" id="31964" maxDurability="85" permanentenchant="2983" randomPropertiesId="0" seed="0" slot="2"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shirt_red_01" id="6796" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="51436659" slot="3"/>
        <
item durability="78" gem0Id="35487" gem1Id="24048" gem2Id="24048" icon="inv_chest_chain_17" id="34799" maxDurability="140" permanentenchant="0" randomPropertiesId="0" seed="1005087310" slot="4"/>
        <
item durability="23" gem0Id="24028" gem1Id="24055" gem2Id="0" icon="inv_belt_13" id="25695" maxDurability="40" permanentenchant="0" randomPropertiesId="0" seed="1027100179" slot="5"/>
        <
item durability="40" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_pants_mail_08" id="25656" maxDurability="75" permanentenchant="3329" randomPropertiesId="0" seed="639254330" slot="6"/>
        <
item durability="33" gem0Id="24028" gem1Id="24048" gem2Id="0" icon="inv_boots_plate_06" id="28545" maxDurability="60" permanentenchant="3329" randomPropertiesId="0" seed="1012214083" slot="7"/>
        <
item durability="27" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_bracer_02" id="28454" maxDurability="50" permanentenchant="0" randomPropertiesId="0" seed="2096922842" slot="8"/>
        <
item durability="28" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_gauntlets_25" id="29085" maxDurability="50" permanentenchant="1594" randomPropertiesId="0" seed="0" slot="9"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_ring_39" id="31077" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="559371100" slot="10"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_ring_44" id="30973" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="736716820" slot="11"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="spell_nature_abolishmagic" id="29776" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="753297262" slot="12"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_jewelry_talisman_04" id="25633" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="1517069178" slot="13"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_misc_cape_22" id="29792" maxDurability="0" permanentenchant="0" randomPropertiesId="0" seed="971203406" slot="14"/>
        <
item durability="38" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_weapon_shortblade_38" id="31492" maxDurability="65" permanentenchant="0" randomPropertiesId="0" seed="1544520360" slot="15"/>
        <
item durability="47" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_weapon_shortblade_38" id="28524" maxDurability="75" permanentenchant="3222" randomPropertiesId="0" seed="991160696" slot="16"/>
        <
item durability="32" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_weapon_rifle_27" id="38241" maxDurability="75" permanentenchant="0" randomPropertiesId="0" seed="713851136" slot="17"/>
        <
item durability="0" gem0Id="0" gem1Id="0" gem2Id="0" icon="inv_shirt_guildtabard_01" id="35221" 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

Estoy intentado hacerlo con

$doc = new DOMDocument();
$doc->load("archivo.xml");

Pero no se hacerlo, y la información que consigo no me sirve de nada, como puedo convertir esos campos en variables? o arrays?

Saludos! Y gracias!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:08.