Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

php - Parsing XML files using CodeIgniter?

Searching the, Internet ,I found http://blog.insicdesigns.com/2009/03/parsing-xml-file-using-codeigniters-simplexml-library/, but I have a lot of questions. I am new to codeigniter, and I am trying to adapt my code to this xml. I want to display once a user logins, but the question is, how would I iterate through a series of child nodes with attributes? alt text

A little code will be really helpfull

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The class you've linked to is for PHP 4. If you're using PHP 4, obviously you should upgrade now. PHP 5 users should use the real deal, SimpleXML. Here's an example for PHP's SimpleXML. If you have questions about SimpleXML (PHP's, not CodeIgniter's knockoff) read the manual's examples a dozen times and if it still doesn't come to you, please post a new question.

$Comprobante = simplexml_load_file('yourfile.xml');
echo $Comprobante->Emisor['nombre'];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...