Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Parsing XML
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 24th May 10:59
ash
External User
 
Posts: 1
Default Parsing XML



Hi All,

I've run into a bit of a problem. I need to parse some fairly detailed
XML files from a remote website. I'm pulling in the remote XML using
curl, and that bit is working fine. The smaller XML do***ents were easy
to parse with regular expressions, as I only needed bit of information
out of them.

The live server I'm eventually putting this onto only has domxml for
working with XML. I've been trying to find the pecl extension for this
to install on my local machine, but the pecl.php.net site is a bit
nerfed for this extension (I'm getting a file not found error message.)

Do any of you have a copy of this extension, or failing that, a
suggestion of how I can parse XML files without having to install
anything on the remote server, as I do not have that level off access to
it.

Thanks
Ash
http://www.ashleysheridan.co.uk
  Reply With Quote


  sponsored links


2 24th May 10:59
nrixham
External User
 
Posts: 1
Default Parsing XML



standard response which has helped a few recently

"you could give this a go if you like (one i made earlier):
http://programphp.com/xmlparser.phps - class at the top, usage at the
bottom."
  Reply With Quote
3 24th May 10:59
nrixham
External User
 
Posts: 1
Default Parsing XML


standard response which has helped a few recently

"you could give this a go if you like (one i made earlier):
http://programphp.com/xmlparser.phps - class at the top, usage at the
bottom."
  Reply With Quote
4 24th May 10:59
ash
External User
 
Posts: 1
Default Parsing XML


I've started using DOMDo***ent for this (I bypassed your code for the
moment as it uses regular expressions, which were a speed bottleneck
with my approach) but I can't find any proper do***entation on it
online. My efforts so far have resulted in a lot of errors which are
nigh on impossible to debug. I've used the dom class in javascript
without problems now, and it seems to look similar, but it's all going
wrong!


Ash
http://www.ashleysheridan.co.uk
  Reply With Quote
5 24th May 10:59
ash
External User
 
Posts: 1
Default Parsing XML


OK, given up on DOMDo***ent, and tried your code Nathan, works
beautifully! Turns out the slow speeds I was experiencing before using
the regexes was down to the remote server serving out the xml do***ent.
Its the armory server on wow-europe, so not too worried about that!


Ash
http://www.ashleysheridan.co.uk
  Reply With Quote
6 24th May 10:59
tularis
External User
 
Posts: 1
Default Parsing XML


the armory at wow-europe? That thing is horribly overloaded
[permanently], get used to it. I've had a few scripts have trouble with
that place aswell, considering connections timed out regularly.

- Tul
  Reply With Quote
7 24th May 11:00
ash
External User
 
Posts: 1
Default Parsing XML


Yeah, the very same.

I'm trying to avoid as much communication with it as possible, by only
updating content once an hour, and then only if that content is
requested, so if the site doesn't get used for a week, no updates are
made. And then, all the data is stored in a database at my end, so I can
query that easily.


Ash
http://www.ashleysheridan.co.uk
  Reply With Quote
8 24th May 11:00
per
External User
 
Posts: 1
Default Parsing XML


Parsing XML is best done with XSL - if that's out of the question,
you're in for a difficult time.


/Per Jessen, Zürich
  Reply With Quote
9 24th May 11:00
ash
External User
 
Posts: 1
Default Parsing XML


XSL will only allow me to convert it into a different do***ent format,
which is not what I want as I need to keep a local copy of information
in a database for searching and sorting purposes. Nathans class allows
me to have the entire do***ent put into an array tree, which is fine for
what I need so far.


Ash
http://www.ashleysheridan.co.uk
  Reply With Quote
10 24th May 11:00
per
External User
 
Posts: 1
Default Parsing XML


That's cool, but XSL is still the more appropriate tool IMO. It does
exactly what you need - it parses and validates the XML do***ent,
allows you to extract the bits you need and in virtually any format you
need - which could be a text do***ent with SQL statements for piping to
mysql.


/Per Jessen, Zürich
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666