Filter an xml file while parsing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gfxl
Forum Newbie
Posts: 1
Joined: Wed Mar 10, 2010 11:49 am

Filter an xml file while parsing

Post by gfxl »

Hi,
So lets say I have the following xml file:

Code: Select all

 <DATABASE>     <PERSON>          <NAME>Jon</NAME>          <SURNAME>Doe</SURNAME>          <GENDER>Male</GENDER>          <AGE>23</AGE>     </PERSON>     <PERSON>          <NAME>Jane</NAME>          <SURNAME>Doe</SURNAME>          <GENDER>Female</GENDER>          <AGE>21</AGE>     </PERSON></DATABASE> 
And I want to tabulate this data without having a field for Gender in the table. Does anyone know how to go about filtering such an xml file when parsing (with php) such that only selected fields are parsed?

I will also add that the xml feed is hosted remotely and I cannot edit it.

Thanks.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Filter an xml file while parsing

Post by AbraCadaver »

mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply