Welcome to OGeek Q&A 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 Reply

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'];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...