Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-05-2003, 08:24 PM   PM User | #1
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Post Read XML with PHP

I want to be able to read something like the following with PHP:

<maintag>
<tag id="x">Info</tag>
<open name="x" num="y">Info</open>
</maintag>

Is this possible? if so could you help!!!

The reason is cos I am running a site using txt files and I would prefer to use XML. Have a look

Thanks

Matt
missing-score is offline   Reply With Quote
Old 02-05-2003, 09:34 PM   PM User | #2
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
There are two ways I know of:

1 - there's a simple api for XML which is native to PHP4 - documented at http://www.php.net/manual/en/ref.xml.php - It works well and it's stable, but there's no validation and it's not a DOM parser - it has no concept of the nature of the document, it just stores the nodes, attributes and values in PHP variables. My experience was initially very positive, but I was more interested in XSLT ...

2 - PHP has XSLT function - documented at http://www.php.net/manual/en/ref.xslt.php - for this you need to install an extension called Sablotron - http://www.gingerall.com/charlie/ga/xml/x_sabphp.xml - and it truly rocks Really simple - takes about 4 lines of PHP, which is particularly great if you want environment independence for your data - and it's a true DOM parser with full XPath support. This is my recomendation

Last edited by brothercake; 02-05-2003 at 09:37 PM..
brothercake is offline   Reply With Quote
Old 02-06-2003, 05:22 AM   PM User | #3
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Thanks

That's what i'm looking for, cheers!

Matt
missing-score is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.