View Full Version : vB_XML_Parser how do I?
Bilderback
11-22-2008, 02:48 AM
I have searched many sites with no luck.
Can anyone refer me to a decent article or usage of the vB_XML_Parser class?
Thanks
EDIT:
I am attempting to retrieve a local xml file data and have tried:
require_once (DIR . '/includes/class_xml.php');
$xml = new vB_XML_Parser($xmldata, $file);
The file exists
But echo or gettype($xmldata) returns NULL
Dismounted
11-22-2008, 05:12 AM
What do you want to do with it?
PS. The best way is to see how vBulletin uses it. It's used in a lot of places.
Bilderback
11-22-2008, 05:21 AM
I plan to use it to read a local xml file and parse the data to a memberinfo template as an extra tab.
Dismounted
11-22-2008, 05:31 AM
You can call the class in two ways. Like this:
$xmldata = '<somexml><value>value</value></somexml>';
$xml = new vB_XML_Parser($xmldata);
Or like this:
$path = '/includes/xml/myxml.xml';
$xml = new vB_XML_Parser(false, $path);
Then parse the data like this:
$parsed = $xml->parse();
$parsed now contains an array of the XML document. Use a print_r() to see what is inside/how it is structured.
Bilderback
11-22-2008, 05:51 AM
Thank you.
My error was in using parsedata instead of parseddata. (missing d)
The following now works:
$xml->parse();
$item = $xml->parseddata[item];
However, there seems to be a significant increase in load time.
Maybe this will change when I get the data to template.
I was using simple_xml() which returned quickly.
Now I just need to figure out how to get the variables to template.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.