0

I need to parse a big XML file, to import some information in to a db, but I'm having troubles accessing all the data inside the XML.

My XML file is something like this:

http://pastebin.com/BzZx0D06

If I do this:

print_r($xml);

I obtain something like:

http://pastebin.com/3AgSryDZ

For every record I'd like to access to the name attribute of card tag, and to the name tag below (italian traslation).

To access the name attribute I can use:

echo (string)$xml->card[0]->attributes()->name;

That Works, but I can't find a way to access to the translated name.

For Example, for the first element I have:

echo (string)$xml->card[0]->attributes()->name;

that return

A Display of My Dark Power

But I can't find the way to get the "Uno Sfoggio del Mio Potere Oscuro" Value.

0

1 Answer 1

1

I think you can access the translation like this:

echo (string)$xml->card[0]->set->name

Sign up to request clarification or add additional context in comments.

2 Comments

I think I must sleep more than 2hr per night... Thanks a lot man :)
You are welcome. Next time, just leave the script alone for two hours and do something completely different :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.