I haven't done this in PHP as PHP comes w/ XML support but times past
when I needed a fast way to parse something like that and knew the
format would be simple I'd usually do something like make a function
that knows all the possible splits w/in a layer (ie items are w/in the
faq layer if they can occur inside faq tags) and then just recursively
explode the string parts based on all know tags for that layer and build
a nested array or prehaps nested objects. That is probably the simplist
way if you don't want to mess w/ real parsing.
If you have Unix access you might see if you can use Perl or a helper
app to parse it into an easier to work w/ format.
Stefen Lars wrote:
> Hello all
>
> I have recently been assigned the task of parsing an xml file and
> format the contents of the file in HTML. The xml file lies on another
> server. Our web space provider does not provide the XML functions (nor
> is he willing to install them) :-gr.
>
> I am sure that I am not the only who has come across this problem.
>
> Would someone have already created a few functions to parse xml that
> they are willing to share?
>
> I have the following structure to deal with:
>
> <faq>
> <item>
> <product>ProductName</product>
> <question>Why does it not work</question>
> <answer>Because it is not turned on<answer>
> <item>
> </faq>
>
> There are whole load of <item>s in the file.
>
> I then want to display the contents a bit like this:
>
> echo $product;
> echo $question;
>
> etc (of course with some HTML formatting, like a bulleted list).
>
> Any help would be really VERY appreciated!
>
> Thanks
>
> S
>
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]