vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   vB_XML_Parser how do I? (https://vborg.vbsupport.ru/showthread.php?t=196914)

Bilderback 11-22-2008 02:48 AM

vB_XML_Parser how do I?
 
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:
PHP Code:

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:
PHP Code:

$xmldata '<somexml><value>value</value></somexml>';
$xml = new vB_XML_Parser($xmldata); 

Or like this:
PHP Code:

$path '/includes/xml/myxml.xml';
$xml = new vB_XML_Parser(false$path); 

Then parse the data like this:
PHP Code:

$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:
Code:

$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.


All times are GMT. The time now is 04:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00944 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete