php-general | 2001092
Date: 09/19/01
- Next message: Alexander Skwar: "Re: [PHP] PHP vs M$.NET C#?"
- Previous message: Mark Charette: "Re: [PHP] Protecting variables and functions? Like C#"
- In reply to: Stefen Lars: "[PHP] Returning a specific 'record' from an XML file"
- Next in thread: Power Programmer: "[PHP] Putting PHP info into a variable"
- Reply: Power Programmer: "[PHP] Putting PHP info into a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
hi ;)
it's pretty simple to do something like this using the DOM functions that
handle XPath expressions.
when you have that xml loaded in a variable $xml_source all you have to do
is:
$doc=xmldoc($xmlsource);
$xpath_ctx = xpath_new_context($doc );
// show all objects
echo "Xpath All";
$result = xpath_eval($xpath_ctx, '//child::*');
print_r($result); // this will show you the structure of the output
// all books objects
$result = xpath_eval($xpath_ctx, '//book::*');
print_r($result);
// book number one:
$result = xpath_eval($xpath_ctx, '//book[1]');
print_r($result);
xpath is much more powerful than that and i'm pretty sure you can use it the
way you want it.
some more info about XPath is available here:
http://www.zvon.org/xxl/XPathTutorial/General/examples.html
Good Luck with that ;)
ZeNDeR-X
-=> www.ipro.pl <=-
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Alexander Skwar: "Re: [PHP] PHP vs M$.NET C#?"
- Previous message: Mark Charette: "Re: [PHP] Protecting variables and functions? Like C#"
- In reply to: Stefen Lars: "[PHP] Returning a specific 'record' from an XML file"
- Next in thread: Power Programmer: "[PHP] Putting PHP info into a variable"
- Reply: Power Programmer: "[PHP] Putting PHP info into a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

