473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

getting data from a feed file

Ok, I have a feed that I need to get the data from. The file is an
html file that contains items. I need to step through the file,
getting the first item, doing whatever, then the second item, and so
on. Any thoughts on the best way to to this?

<Feed>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
</Feed>

Jun 14 '07 #1
5 1584
On Jun 14, 3:59 pm, j...@mynetserv.com wrote:
Ok, I have a feed that I need to get the data from. The file is an
html file that contains items. I need to step through the file,
getting the first item, doing whatever, then the second item, and so
on. Any thoughts on the best way to to this?

<Feed>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
</Feed>


Yes, try these functions (explained at php.net with examples):

xml_parser_create()
xml_parser_set_option()
xml_parse_into_struct()
xml_parser_free()

These four , come one after another, and they will help you parse the
file easier.

If you prefer regular expressions, let me know :-)

BeachAndCocktails

Jun 14 '07 #2
je***@mynetserv.com wrote:
Ok, I have a feed that I need to get the data from. The file is an
html file that contains items. I need to step through the file,
getting the first item, doing whatever, then the second item, and so
on. Any thoughts on the best way to to this?

<Feed>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
</Feed>
Did you check out the DOM functions in PHP 5 (or DOM XML functions in
PHP 4)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 14 '07 #3
On Jun 14, 12:54 pm, Vladimir Ghetau <vladi...@pixeltomorrow.com>
wrote:
On Jun 14, 3:59 pm, j...@mynetserv.com wrote:
Ok, I have a feed that I need to get the data from. The file is an
html file that contains items. I need to step through the file,
getting the first item, doing whatever, then the second item, and so
on. Any thoughts on the best way to to this?
<Feed>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
<Item>
<ID>Data I need</ID>
<Title>Data I need</Title>
</Item>
</Feed>

Yes, try these functions (explained at php.net with examples):

xml_parser_create()
xml_parser_set_option()
xml_parse_into_struct()
xml_parser_free()

These four , come one after another, and they will help you parse the
file easier.

If you prefer regular expressions, let me know :-)

BeachAndCocktails
I am looking into the xml_parser_ functions. Currently my feed doesn't
seem to be XML encoded, or complaint.

How would I do it with regular expressions?

Jun 14 '07 #4
How would I do it with regular expressions?

http://www.phpclasses.org/browse/package/3504.html
Enjoy,

Vladimir
http://pixeltomorrow.com
Jun 17 '07 #5
jerry wrote:
I am looking into the xml_parser_ functions. Currently my feed doesn't
seem to be XML encoded, or complaint.
The example you gave was.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 113 days, 23:54.]

You're Not Allowed to Take Pictures of the US Embassy in Rome
http://tobyinkster.co.uk/blog/2007/06/16/us-embassy/
Jun 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ru | last post by:
Hello, I'm trying to parse a rss 1.0 docoment like the following example from http://www.instapundit.com: <?xml version="1.0" encoding="iso-8859-1" ?> - <rdf:RDF...
2
by: N. Graves | last post by:
I'm planning to develop a process to import data from an external flat file to a new table automatically. As usual I'm having a hard time getting started on the solution because of the Access's...
7
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem...
7
by: billy | last post by:
Hello, I have an XML data feed that I would like to use to create tables in SQL Server. The xml data feed consists of a large amount of information that changes on a regualar basis. Is there a...
15
by: Brady Love | last post by:
I am currently working an an app that will post and edit blogs on blogger. Right now I have it so I can recive a list of the blogs and the content of those blogs using Atomizer. This is my first...
1
by: jcsnippets.atspace.com | last post by:
Hi everyone, I'm trying to read an xml config file in C#. To do this, I have used the xsd.exe tool to create an xsd file from my xml, and to generate code to read this xml file. Here is a...
5
by: Ed Flecko | last post by:
Hi folks, I'm trying to figure out this whole RSS feed thing. I've created my .xml file to use for my feed, and my browsers "recognize" that I have an RSS feed, and you can subscribe, etc., etc....
1
by: FLX | last post by:
Hello, I'm trying to scrape daily titles from http://www.doopes.com/?cat=35444&lang=1&num=5&mode=0&from=2007-09-04&to=2007-09-04&exc=&inc=&opt=0 But i'm getting lost using preg_match. Can someone...
7
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.