[PHP] PHP within XML?

2011-08-25 Thread Ron Piggott

I am trying to figure out if it is possible to have PHP work within an XML 
document.

The application is tracking RSS subscribers IP addresses within the database.

I have wrote functions so the PHP code required is below is minimal, after the 
XML declaration line.  

Prior to posting this question I tried to have the PHP at the very start, but 
that doesn’t work, the declaration line needs to be first.

Right now the PHP is displayed as a comment.

Thoughts anyone?

Ron

===

?xml version=1.0 encoding=utf-8?
?php

#load RSS XML function

require_once(rss_subscribers_xml.php);

$ip_address = _ip;
rss_subscriber_update($ip_address);

?

RSS content starts here 

===

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info  


Re: [PHP] PHP within XML?

2011-08-25 Thread John Black

On 25.08.2011 16:06, Ron Piggott wrote:

I am trying to figure out if it is possible to have PHP work within an XML 
document.
Right now the PHP is displayed as a comment.
Thoughts anyone?
Ron


How are you executing the XML file? By calling it with your browser?
You may need to tell your webserver that you want to treat your xml file 
as a PHP document.


You can use .htaccess for this and add something like this:
Files YourXMLFile
 ForceType application/x-httpd-php
/Files

Hope this helps.
--
John



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP within XML?

2011-08-25 Thread Ken Robinson

Quoting Ron Piggott ron.pigg...@actsministries.org:



I am trying to figure out if it is possible to have PHP work within  
an XML document.


The application is tracking RSS subscribers IP addresses within the database.

I have wrote functions so the PHP code required is below is minimal,  
after the XML declaration line.


Prior to posting this question I tried to have the PHP at the very  
start, but that doesn’t work, the declaration line needs to be first.


Right now the PHP is displayed as a comment.


In order for your PHP code to be processed the file should be named  
with a .php extension. Since you're writing XML code, you need to send  
an XML header type first:

?php
header (Content-Type:text/xml);

#load RSS XML function

require_once(rss_subscribers_xml.php);

$ip_address = _ip;
rss_subscriber_update($ip_address);

echo '?xml version=1.0 encoding=utf-8?' . \n;
?
Rest of your XML content.


This should work.

Ken


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php and XML BibTeX

2010-01-13 Thread Michael A. Peters

Hi -

Currently on my web site, book and article references are just stored in 
the database. While it works, I actually would like to move that out of 
the database and to an XML file, the reason being is that if/when I need 
to add fields etc. to the referenced sources, it's a lot easier to just 
edit a text file than modify database and recode my form interface for 
modifying the database. Also, there's an existing XML format for bibTeX 
and there already are tools to go from that to real bibTex, which I 
may need to do at some point.


What I'm hoping is that already exists some php classes / functions for 
dealing with the XML bibTeX but I haven't found them. Anyone know of any?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php and XML BibTeX

2010-01-13 Thread Paul M Foster
On Wed, Jan 13, 2010 at 12:45:53PM -0800, Michael A. Peters wrote:

 Hi -

 Currently on my web site, book and article references are just stored in
 the database. While it works, I actually would like to move that out of
 the database and to an XML file, the reason being is that if/when I need
 to add fields etc. to the referenced sources, it's a lot easier to just
 edit a text file than modify database and recode my form interface for
 modifying the database. Also, there's an existing XML format for bibTeX
 and there already are tools to go from that to real bibTex, which I
 may need to do at some point.

 What I'm hoping is that already exists some php classes / functions for
 dealing with the XML bibTeX but I haven't found them. Anyone know of any?

I don't know, but the first place I look for things like that is
phpclasses.org.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and XML

2009-11-22 Thread Juan Marcelo Rodríguez Monti

Hi people,
I have some doubts about this topic that I'm gonna explain.

I have a few sites in flash, and I was requested to write a PHP frontend 
to send news. I have this already done and it works perfect. It's a LAMP 
App to send and edit news, post video, images and so on.


Then, I need to put all this news into the Flash site. So, I need to use 
XML. I'm not gonna discuss about Flash, because this is a PHP List, 
however I would like to talk about PHP and XML.


What do you recommend me to produce XML from those news of the SQL 
database?. What do you suggest to output XML from the existing content 
to then put those XML files into Flash.


The posted news are saved in a MySQL database. I don't know if do I need 
to output from PHP then parse the output and convert it to XML, or if Do 
I need to get the array from the MySQL and directly output this to an 
XML file to then get from this file from Flash.


Thanks,
Juan.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML

2009-11-22 Thread Phpster
I would just use concatenations and strings to build the XML. It's not  
gonna matter to the flash swf when it gets the string as it will  
attempt the data as XML.

Bastien

Sent from my iPod

On Nov 22, 2009, at 2:27 PM, Juan Marcelo Rodríguez Monti j...@rodriguezmonti.com.a 
r wrote:



Hi people,
I have some doubts about this topic that I'm gonna explain.

I have a few sites in flash, and I was requested to write a PHP  
frontend to send news. I have this already done and it works  
perfect. It's a LAMP App to send and edit news, post video, images  
and so on.


Then, I need to put all this news into the Flash site. So, I need to  
use XML. I'm not gonna discuss about Flash, because this is a PHP  
List, however I would like to talk about PHP and XML.


What do you recommend me to produce XML from those news of the SQL  
database?. What do you suggest to output XML from the existing  
content to then put those XML files into Flash.


The posted news are saved in a MySQL database. I don't know if do I  
need to output from PHP then parse the output and convert it to XML,  
or if Do I need to get the array from the MySQL and directly output  
this to an XML file to then get from this file from Flash.


Thanks,
Juan.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML

2009-11-22 Thread Sudheer Satyanarayana


What do you recommend me to produce XML from those news of the SQL 
database?. What do you suggest to output XML from the existing content 
to then put those XML files into Flash.


The posted news are saved in a MySQL database. I don't know if do I 
need to output from PHP then parse the output and convert it to XML, 
or if Do I need to get the array from the MySQL and directly output 
this to an XML file to then get from this file from Flash.
From your PHP script, query the database, obtain the results in an 
array or object. Using the result variable build the XML file.



--

With warm regards,
Sudheer. S
Tech stuff: http://techchorus.net - Pro PHP XML - Book Review
Business: http://binaryvibes.co.in


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP/MYSQL/XML Conversion

2007-07-23 Thread Kelvin Park
I'm trying to convert joined multiple database table to one xml file. Is 
it more efficient to initially, join multiple (more that 4 tables) 
together to produce XML file, or convert every table in to XML file and 
use those XML files to relate data?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP/MYSQL/XML Conversion

2007-07-23 Thread Nathan Nobbe

certainly it is better to use the database, as it is designed for such a
purpose.

-nathan

On 7/23/07, Kelvin Park [EMAIL PROTECTED] wrote:


I'm trying to convert joined multiple database table to one xml file. Is
it more efficient to initially, join multiple (more that 4 tables)
together to produce XML file, or convert every table in to XML file and
use those XML files to relate data?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MYSQL/XML Conversion

2007-07-23 Thread Chris

Kelvin Park wrote:
I'm trying to convert joined multiple database table to one xml file. Is 
it more efficient to initially, join multiple (more that 4 tables) 
together to produce XML file, or convert every table in to XML file and 
use those XML files to relate data?


I'd make the database do all the work.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-29 Thread Richard Lynch
On Fri, January 26, 2007 2:36 pm, Ritesh Nadhani wrote:
 Hello all

 As part of my research under my professor I have to implement a web
 interface to their benchmarking data.

 PHP is the chosen web language but we are little worried about the
 database. The benchmark data comes to us in XML format (e.g.
 http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).
 We have to implement an interface to query them, get data, update etc.

 We even can change schema in the form of attributes. . The data size
 would be around 100 MB each XML with around 100 different XMLs.

 The load would be max 5-10 users any given time, batch updates once a
 month and heavy load probably 2-3 times a month. Mission criticality
 is
 not important, we can get it down sometimes. Which db would you
 suggest?

 I did Google research and as of now - I like eXist, Sedna (they seem
 to
 have good PHP wrapper support) and Timber. Another thing would be good
 documentation and support.

 Any suggestions?

MySQL with the XML Engine would be my first suggestion to check out.

You would just slurp down the XML and then use simple standard SQL
queries on the local copy.

I dunno how fast/stable it is, nor even what version of MySQL it
appears in, but it's there somewhere.

There are almost for sure other more common RDBMS that let you
pretend that XML is just another database storage file format, and
run regular old SQL queries on it.  I think PostgreSQL can do this,
actually.  I wouldn't be shocked to find out that SQL Server even has
something truly ugly to do it, but it would work.

An even simpler method, if you only get updates once a month, would be
to write a monthly import script that just loads in the XML to a
normal database, with some kind of automated conversion of the XML
attributes/tags to column names.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-29 Thread Richard Lynch
On Fri, January 26, 2007 6:10 pm, Ritesh Nadhani wrote:
 Hello

 Bernhard Zwischenbrugger wrote:
 Hi

 Some questions

 As part of my research under my professor I have to implement a web
 interface to their benchmarking data.

 PHP is the chosen web language but we are little worried about the
 database. The benchmark data comes to us in XML format (e.g.
 http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).
 We have to implement an interface to query them, get data, update
 etc.

 You can parse the XML, extract the data, put it to an SQL DB and
 move
 the XML to /dev/null (delete it).
 If you do that, you don't need an XML DB.
 Is this possible?


 No. My professor is dead against that. Many people have suggested me
 doing that. Why? Are XML databases incorrectly implemented or are bad?

I think it's safe to say that at least some XML databases are
incorrectly implemented, or even bad. :-)

The answers you keep getting are because without a driving reason to
use the features specific to XML, using XML as the database backend is
probably a Bad Idea.

So unless you explain WHY you want the XML db, and unless those
reasons make sense to need an XML db, you'll keep getting people
telling you, effectively, to Don't do that.

 We even can change schema in the form of attributes. . The data
 size
 would be around 100 MB each XML with around 100 different XMLs.

 What do you mean by different XMLs?
 Are you looking for a maschine that makes SQL Tables from XML?
 What is inside of the 100MB XML? Your example is a MathML Formula.


 By different XMLs I meants, different XML files. So we can have 40 XML
 files with around 50-100 MB each.

 Yes, they will have lot sof those MathML formulas. Its benchmarking
 data
 from some theoritical group that my professor works with. They have
 all
 their database in XML so relational database is not possible otherwise
 we will have to convert them between XML and relational all the time.

How exactly will your converted XML get folded back into the other
data stores?...

This is your big challenge, upon which everything else hinges.

 The load would be max 5-10 users any given time, batch updates once
 a
 month and heavy load probably 2-3 times a month. Mission
 criticality is
 not important, we can get it down sometimes. Which db would you
 suggest?

You have to define heavy load unless your max 5-10 *is* the heavy
load in which case you'd have to work hard to screw this up enough to
not be able to handle the load, I think...

Though I dunno for sure what performance of XML backend is like...

 I did Google research and as of now - I like eXist, Sedna (they
 seem to
 have good PHP wrapper support) and Timber. Another thing would be
 good
 documentation and support.

I've never even heard of eXist nor Sedna, which is why I'm suggesting
you choose something a bit (okay a LOT) more mainstream like MySQL,
where you'll have zillions of fellow users to help out.

 So my question is: out of the six systems listed above, which one you
 would suggest? Has anybody used any of the above system before? What
 are
 your experiences?

I've never actually been silly enough to insist on storying actual
data as XML and pretending it's a DB, rather than storing it as DB and
then writing scripts to output it as if it were XML...

Unless you've got shared data segments scattered all across the world,
forcing it all into XML is probably the First Mistake.  But since
that's your professors' problem, and not yours, I can see how you've
got little choice in the matter.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-29 Thread Ritesh Nadhani

Thank you Bernhard and Richard

Your comments have been really helpful. I have a meeting with the
professor on Wednesday and I will lay down all this points in front of
him then.

On 1/29/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Fri, January 26, 2007 6:10 pm, Ritesh Nadhani wrote:
 Hello

 Bernhard Zwischenbrugger wrote:
 Hi

 Some questions

 As part of my research under my professor I have to implement a web
 interface to their benchmarking data.

 PHP is the chosen web language but we are little worried about the
 database. The benchmark data comes to us in XML format (e.g.
 http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).
 We have to implement an interface to query them, get data, update
 etc.

 You can parse the XML, extract the data, put it to an SQL DB and
 move
 the XML to /dev/null (delete it).
 If you do that, you don't need an XML DB.
 Is this possible?


 No. My professor is dead against that. Many people have suggested me
 doing that. Why? Are XML databases incorrectly implemented or are bad?

I think it's safe to say that at least some XML databases are
incorrectly implemented, or even bad. :-)

The answers you keep getting are because without a driving reason to
use the features specific to XML, using XML as the database backend is
probably a Bad Idea.

So unless you explain WHY you want the XML db, and unless those
reasons make sense to need an XML db, you'll keep getting people
telling you, effectively, to Don't do that.

 We even can change schema in the form of attributes. . The data
 size
 would be around 100 MB each XML with around 100 different XMLs.

 What do you mean by different XMLs?
 Are you looking for a maschine that makes SQL Tables from XML?
 What is inside of the 100MB XML? Your example is a MathML Formula.


 By different XMLs I meants, different XML files. So we can have 40 XML
 files with around 50-100 MB each.

 Yes, they will have lot sof those MathML formulas. Its benchmarking
 data
 from some theoritical group that my professor works with. They have
 all
 their database in XML so relational database is not possible otherwise
 we will have to convert them between XML and relational all the time.

How exactly will your converted XML get folded back into the other
data stores?...

This is your big challenge, upon which everything else hinges.

 The load would be max 5-10 users any given time, batch updates once
 a
 month and heavy load probably 2-3 times a month. Mission
 criticality is
 not important, we can get it down sometimes. Which db would you
 suggest?

You have to define heavy load unless your max 5-10 *is* the heavy
load in which case you'd have to work hard to screw this up enough to
not be able to handle the load, I think...

Though I dunno for sure what performance of XML backend is like...

 I did Google research and as of now - I like eXist, Sedna (they
 seem to
 have good PHP wrapper support) and Timber. Another thing would be
 good
 documentation and support.

I've never even heard of eXist nor Sedna, which is why I'm suggesting
you choose something a bit (okay a LOT) more mainstream like MySQL,
where you'll have zillions of fellow users to help out.

 So my question is: out of the six systems listed above, which one you
 would suggest? Has anybody used any of the above system before? What
 are
 your experiences?

I've never actually been silly enough to insist on storying actual
data as XML and pretending it's a DB, rather than storing it as DB and
then writing scripts to output it as if it were XML...

Unless you've got shared data segments scattered all across the world,
forcing it all into XML is probably the First Mistake.  But since
that's your professors' problem, and not yours, I can see how you've
got little choice in the matter.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?





--
Ritesh
http://www.riteshn.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP with XML database

2007-01-26 Thread Ritesh Nadhani

Hello all

As part of my research under my professor I have to implement a web 
interface to their benchmarking data.


PHP is the chosen web language but we are little worried about the 
database. The benchmark data comes to us in XML format (e.g. 
http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).

We have to implement an interface to query them, get data, update etc.

We even can change schema in the form of attributes. . The data size 
would be around 100 MB each XML with around 100 different XMLs.


The load would be max 5-10 users any given time, batch updates once a 
month and heavy load probably 2-3 times a month. Mission criticality is 
not important, we can get it down sometimes. Which db would you suggest?


I did Google research and as of now - I like eXist, Sedna (they seem to 
have good PHP wrapper support) and Timber. Another thing would be good 
documentation and support.


Any suggestions?

Ritesh

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-26 Thread Bernhard Zwischenbrugger
Hi

Some questions

 As part of my research under my professor I have to implement a web 
 interface to their benchmarking data.
 
 PHP is the chosen web language but we are little worried about the 
 database. The benchmark data comes to us in XML format (e.g. 
 http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).
 We have to implement an interface to query them, get data, update etc.

You can parse the XML, extract the data, put it to an SQL DB and move
the XML to /dev/null (delete it).
If you do that, you don't need an XML DB.
Is this possible?

 
 We even can change schema in the form of attributes. . The data size 
 would be around 100 MB each XML with around 100 different XMLs.

What do you mean by different XMLs?
Are you looking for a maschine that makes SQL Tables from XML?
What is inside of the 100MB XML? Your example is a MathML Formula.

 
 The load would be max 5-10 users any given time, batch updates once a 
 month and heavy load probably 2-3 times a month. Mission criticality is 
 not important, we can get it down sometimes. Which db would you suggest?
 
 I did Google research and as of now - I like eXist, Sedna (they seem to 
 have good PHP wrapper support) and Timber. Another thing would be good 
 documentation and support.

With an XML DB you can query data using XPATH. Is that the thing you
want? Oracle supports that for example.

Bernhard

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-26 Thread Ritesh Nadhani

Hello

Bernhard Zwischenbrugger wrote:

Hi

Some questions

As part of my research under my professor I have to implement a web 
interface to their benchmarking data.


PHP is the chosen web language but we are little worried about the 
database. The benchmark data comes to us in XML format (e.g. 
http://www.matf.bg.ac.yu/~filip/ArgoLib/smt-lib-xml/Examples/FolEq1.xml).

We have to implement an interface to query them, get data, update etc.


You can parse the XML, extract the data, put it to an SQL DB and move
the XML to /dev/null (delete it).
If you do that, you don't need an XML DB.
Is this possible?



No. My professor is dead against that. Many people have suggested me 
doing that. Why? Are XML databases incorrectly implemented or are bad?


We even can change schema in the form of attributes. . The data size 
would be around 100 MB each XML with around 100 different XMLs.


What do you mean by different XMLs?
Are you looking for a maschine that makes SQL Tables from XML?
What is inside of the 100MB XML? Your example is a MathML Formula.



By different XMLs I meants, different XML files. So we can have 40 XML 
files with around 50-100 MB each.


Yes, they will have lot sof those MathML formulas. Its benchmarking data 
from some theoritical group that my professor works with. They have all 
their database in XML so relational database is not possible otherwise 
we will have to convert them between XML and relational all the time.


The load would be max 5-10 users any given time, batch updates once a 
month and heavy load probably 2-3 times a month. Mission criticality is 
not important, we can get it down sometimes. Which db would you suggest?


I did Google research and as of now - I like eXist, Sedna (they seem to 
have good PHP wrapper support) and Timber. Another thing would be good 
documentation and support.


With an XML DB you can query data using XPATH. Is that the thing you
want? Oracle supports that for example.



Yeah but looking at 
http://www.oracle.com/technology/tech/xml/xmldb/index.html, I could not 
find whether its free. I might be wrong but the info is not easily found 
there.


One the contrary IBMs offering at 
http://www-306.ibm.com/software/data/db2/express/download.html looks FREE.


The problem is that both the above two database are beasts in themselves 
and I just require 10% of what they do :)


We looked into Berkeley DB also but their support for PHP is not that 
great. We have compile the module by ourselves etc (this is not a 
problem though as we have the technical know how to do that) but lot of 
people have suggested that its not a very stable system. I have not done 
any benchmarking on it but I dont want to change my underlying DB couple 
of months down the line just because we found out its not stable.


Apart from the above big three, the other free and reasonable good 
implementation seems to be eXist, Timber and Sedna. This I am just 
saying by reading their website. I have not used them.


So my question is: out of the six systems listed above, which one you 
would suggest? Has anybody used any of the above system before? What are 
your experiences?



Bernhard



Ritesh






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP with XML database

2007-01-26 Thread Bernhard Zwischenbrugger
Hi again

I don't know what the DB should do for you.

If you simple want to select subtrees from your big XML, you can put
the XML Files to the filesystem and use XPointer for query.

Here an example:

?php
$xml=END
result xmlns:xi=http://www.w3.org/2001/XInclude; 
xmlns:xhtml=http://www.w3.org/1999/xhtml;
xi:include 
href=http://www.laptop.org/vision/index.shtml#xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(//xhtml:div[1]//xhtml:div[1])
 parse=xml
   xi:fallback
   errornot found/error
   /xi:fallback
  /xi:include
/result
END;

$dom=domDocument::loadXML($xml);
$dom-xinclude();

header(Content-type:text/xml);
echo $dom-saveXML();
?

This example loads an XML (xhtml) from the web (filesystem is also
possible) and outputs a subtree of the document.
The subtree is selected by an XPointer expression.

The XML: http://www.laptop.org/vision/index.shtml
The XPointer:
#xmlns(xhtml=http://www.w3.org/1999/xhtml)xpointer(//xhtml:div[1]//xhtml:div[1])
(the namespace part is a little tricki)

To parse 100MByte takes some time.
A database can improve speed, the query syntax (XPointer) maybe is the
same.
Without knowing what the output of the database should be und the query
parameters, it is not easy to tell what db is the best for you.

A solution could be to split the 100MByte file in small parts and store
the subtrees to blobs in mySql. You can build an index based on XPath
and it could be a real fast solution.



Bernhard



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 6:57 am, onewaylife wrote:
 I am novice in PHP  XML, while trying I am creating a small
 application
 i.e. Address Book.
 In this I am using Apache2, PHP5 and XML no database is used. I have
 FC5
 machines. but I am unable to store the files in XML. If any one share
 their
 experience in this by providing Examples or tutorials etc...
 So far I have found tutorial related to porting the information of
 data from
 MySQL to XML and then php with help of DOM.

You could just slap the whole address book into a single file with:
http://php.net/file_put_contents
http://php.net/file_get_contents

This, however, will get unwieldy for more than a few hundred addresses...

To fix that, you're going to have to basically re-implement a bunch
of functionality that is pretty much the nuts and bolts of a database,
so I'd suggest that maybe your inexperience is causing you to make a
Bad Choice for how to go about making an address book in the first
place. :-)

Note that you could also store it all in a database, and then provide
an XML output for, say, RSS or other portable reasons. And while it's
more work, the extra effort of the DB will actually be LESS work
than Doing It Right with just the raw file system access you propose.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and XML

2006-11-23 Thread onewaylife

Dear All

I am novice in PHP  XML, while trying I am creating a small application
i.e. Address Book. 
In this I am using Apache2, PHP5 and XML no database is used. I have FC5
machines. but I am unable to store the files in XML. If any one share their
experience in this by providing Examples or tutorials etc... 
So far I have found tutorial related to porting the information of data from
MySQL to XML and then php with help of DOM. 

Thanks 
onewaylife
-- 
View this message in context: 
http://www.nabble.com/PHP-and-XML-tf2692397.html#a7507917
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP and XML

2006-11-23 Thread Edward Kay
Hello,

You say that you are unable to store the files in XML. Why is this? Are
you getting an error message or do you just not know where to start?

Edward

 Dear All

 I am novice in PHP  XML, while trying I am creating a small application
 i.e. Address Book.
 In this I am using Apache2, PHP5 and XML no database is used. I have FC5
 machines. but I am unable to store the files in XML. If any one
 share their
 experience in this by providing Examples or tutorials etc...
 So far I have found tutorial related to porting the information
 of data from
 MySQL to XML and then php with help of DOM.

 Thanks
 onewaylife
 --
 View this message in context:
 http://www.nabble.com/PHP-and-XML-tf2692397.html#a7507917
 Sent from the PHP - General mailing list archive at Nabble.com.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP and XML

2006-11-23 Thread Vincent DUPONT

Hi,

what do you plan to do with XML? Store your adresses, etc?

Then you can create an XML object with simpleXML (see 
http://be2.php.net/simplexml/)
This will help you in adding nodes and attributes.
Afterward, you can generate a output with $xml-asXML() and store this into a 
file  with file_put_content($xml-asXML());


If you edit a xml file in a text editor, you will see it is rather simple
study the simpleXML methods and you are ready !

best whishes !
vincent



-Original Message-
From: onewaylife [mailto:[EMAIL PROTECTED]
Sent: Thu 23/11/2006 13:57
To: php-general@lists.php.net
Subject: [PHP] PHP and XML
 

Dear All

I am novice in PHP  XML, while trying I am creating a small application
i.e. Address Book. 
In this I am using Apache2, PHP5 and XML no database is used. I have FC5
machines. but I am unable to store the files in XML. If any one share their
experience in this by providing Examples or tutorials etc... 
So far I have found tutorial related to porting the information of data from
MySQL to XML and then php with help of DOM. 

Thanks 
onewaylife
-- 
View this message in context: 
http://www.nabble.com/PHP-and-XML-tf2692397.html#a7507917
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5 XML Dom, set doctype and system

2005-12-07 Thread Mariano Guadagnini

Hello,
I need to set the doctype and the system dtd of a document created 
directly with the xml DOM.
I couldn´t find any function or property to set this, i saw some 
examples that directly wrote onto the file manually, but i´m pretty sure 
thare must be a way to do this  with the dom (i remembered that libxml c 
api has such capability, so, if php dom is based on such, then it would 
be able to).

Any ideas?

Thanks in advance,

cheers.

Mariano.



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.12/193 - Release Date: 06/12/2005

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5 XML/XSL problem

2005-11-07 Thread Daniel Lowes

Hi

I've been using PHP 4 for the last year to do XSL transformations in one 
of my applications. It worked like a charm, we never had any problems. 
While I was investigating the feasability of moving to PHP 5, I 
discovered that for some reason, the exact same XML/XSL fails to 
transform properly. The relevant bit of XSL is below:



xsl:param name=pageContext select=UNDEFINED /
xsl:variable name=sections select=document('../xml/sections.xml') /

xsl:variable name=targetID select=//[EMAIL PROTECTED] = $pageContext]/@id 
/
xsl:variable name=targetFileSrc 
select=$sections/sections/[EMAIL PROTECTED] = $targetID] /


xsl:variable name=targetFile
xsl:choose
xsl:when test=($targetFileSrc/sectionContentSrc = 'none') or 
(string-length($targetFileSrc/sectionContentSrc) = 0)

xsl:copy-of select=document('../xml/default.xml') /
/xsl:when
xsl:otherwise
xsl:copy-of select=document(concat('../xml/', 
$targetFileSrc/sectionContentSrc)) /

/xsl:otherwise
/xsl:choose
/xsl:variable

xsl:variable name=cornerImage 
select=$targetFile/content/headerContent/headerCornerImage /
xsl:variable name=shadowImage 
select=$targetFile/content/headerContent/headerShadowImage /

--

with some sample XML as follows:

--
content
headerContent

headerCornerImagehome_nav_middle.gif/headerCornerImage
headerShadowImagehome_nav_bottom.gif/headerShadowImage

/headerContent
/content


I've checked and confirmed that pageContext gets properly initialised, 
that all the referenced documents exist and are well-formed, and that 
they contain the expected nodes. The error I get is evaluating variable 
'cornerImage' failed, yet I cannot understand how this can be so. Apart 
from the fact that it worked perfectly fine in PHP 4, all the XML and 
XSL conforms to spec. Anyone have an idea? I'm using the PHP 5 DOM and 
XSL libraries to handle everything in my upgraded version of the code; 
the PHP 4 version used DOMXML and Sablotron.



--
Pleochism: a moment of perfect beauty, between the before and the after.

Mr Daniel Lowes
Techteam
Department of Computer Science
Information Technology Building, 4-30
University of Pretoria
http://www.cs.up.ac.za/

This message and attachments are subject to a disclaimer. Please refer 
to www.it.up.ac.za/documentation/governance/disclaimer/ for full details.
Hierdie boodskap en aanhangsels is aan 'n vrywaringsklousule onderhewig. 
Volledige besonderhede is by 
www.it.up.ac.za/documentation/governance/disclaimer/ beskikbaar.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP and XML

2005-10-06 Thread Rick Emery

Quoting Robbert van Andel [EMAIL PROTECTED]:


Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM based
installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line.  How do I do this when we did not build
PHP from source?  Is there another way to get XSL activated?

Thanks for your help
Robbert


You don't mention which distro you're using, but Fedora Core 4 has a 
php-xml rpm to ...add support to PHP for manipulating XML documents 
using the DOM tree, and performing XSL transformations on XML 
documents.


Hope this helps,
Rick
--
Rick Emery

When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return
 -- Leonardo Da Vinci

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP and XML

2005-10-06 Thread Robbert van Andel
Yes, I resolved the problem today by installing this RPM via yum.  I had
assumed it was already installed because I was able to do some XML parsing
without it.  

I was able to get the XML transformed and it looks good, if I do say so
myself :)

Robbert

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 06, 2005 8:05 AM
To: php-general@lists.php.net
Subject: RE: [PHP] PHP and XML

Quoting Robbert van Andel [EMAIL PROTECTED]:

 Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM
based
 installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
 comes standard with PHP 5 and you need to enable it by adding the argument
 --with-xsl to the configure line.  How do I do this when we did not build
 PHP from source?  Is there another way to get XSL activated?

 Thanks for your help
 Robbert

You don't mention which distro you're using, but Fedora Core 4 has a 
php-xml rpm to ...add support to PHP for manipulating XML documents 
using the DOM tree, and performing XSL transformations on XML 
documents.

Hope this helps,
Rick
-- 
Rick Emery

When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return
  -- Leonardo Da Vinci

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and XML

2005-10-05 Thread php

My company recently installed google's search appliance and I am working
on some scripts to display the search results on our various websites. 
The problem I'm having is using the XML parsing functions I've used on
other pages is not working because the returned XML has invalid xml
characters in it.  For example, the data between the xml tags include
html tags that are supposed to be displayed.  But when I parse the xml,
the parse sees these tags as new start tags.  Is there a way to work
around this or a different way to parse this document?  I've heard a
little about XSLT really don't know anything about it and am wondering
if that is the way to deal with it?

Here is a part of the XML returned by the google appliance:
GSP VER=3.2
TM0.008398/TM
Qinformation services/Q
PARAM name=q value=information services
original_value=information+services/
PARAM name=site value=shpolicy original_value=shpolicy/
PARAM name=client value=shpolicy original_value=shpolicy/
PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/
PARAM name=btnG value=Google_Search
original_value=Google+Search/
PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/
PARAM name=access value=p original_value=p/
-
RES SN=1 EN=10
M86/M
FI/
-
NB
-
NU
/search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient=shpolicyaccess=psort=date:D:L:d1start=10sa=N
/NU
/NB
-
R N=1 MIME=application/pdf
-
U
http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%20Services%20Software%20Purchasing%20Policy.pdf
/U
-
UE
http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.pdf
/UE
-
T
bInformation/b bServices/b Software Purchasing
/T
RK5/RK
FS NAME=date VALUE=2005-09-07/
-
S
 b.../b Administrative Housewide Policy bInformation/b
bServices/b Software Purchasing Applicablebr Campus: Salem and
West Valley Hospitals Department Name: bInformation/b b.../b  
/S
-
HAS
L/
C SZ= CID=4_wracnOVC8:/
/HAS
/R

I can send the parsing code but it's fairly straight forward and I
didn't want to needlessly fill up the email.

Any suggestions?

Thanks,
Robbert van Andel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML

2005-10-05 Thread Stephen Leaf
On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote:
 My company recently installed google's search appliance and I am working
 on some scripts to display the search results on our various websites.
 The problem I'm having is using the XML parsing functions I've used on
 other pages is not working because the returned XML has invalid xml
 characters in it.  For example, the data between the xml tags include
 html tags that are supposed to be displayed.  But when I parse the xml,
 the parse sees these tags as new start tags.  Is there a way to work
 around this or a different way to parse this document?  I've heard a
 little about XSLT really don't know anything about it and am wondering
 if that is the way to deal with it?
XSL can display the contents using a 
xsl:copy-of select=node/
bear in mind tho that it also copies the node name.
example:
nodecopied stuffbr//node

copying only the inner content can be achieved by doing a select=. however 
you'll need to have the current node be the one that you want copied.
this can be done by using a
xsl:for-each select=node
xsl:copy-of select=./
/xsl:for-each

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to 
accomplish it.


 Here is a part of the XML returned by the google appliance:
 GSP VER=3.2
 TM0.008398/TM
 Qinformation services/Q
 PARAM name=q value=information services
 original_value=information+services/
 PARAM name=site value=shpolicy original_value=shpolicy/
 PARAM name=client value=shpolicy original_value=shpolicy/
 PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/
 PARAM name=btnG value=Google_Search
 original_value=Google+Search/
 PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/
 PARAM name=access value=p original_value=p/
 -
   RES SN=1 EN=10
 M86/M
 FI/
 -
   NB
 -
   NU
 /search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient
=shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU
 /NB
 -
   R N=1 MIME=application/pdf
 -
   U
 http://shpolicy.shservices.org/administrative/InformationServices/housewide
applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U
 -
   UE
 http://shpolicy.shservices.org/administrative/InformationServices/housewide
applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.p
df /UE
 -
   T
 bInformation/b bServices/b Software Purchasing
 /T
 RK5/RK
 FS NAME=date VALUE=2005-09-07/
 -
   S
  b.../b Administrative Housewide Policy bInformation/b
 bServices/b Software Purchasing Applicablebr Campus: Salem and
 West Valley Hospitals Department Name: bInformation/b b.../b
 /S
 -
   HAS
 L/
 C SZ= CID=4_wracnOVC8:/
 /HAS
 /R

 I can send the parsing code but it's fairly straight forward and I
 didn't want to needlessly fill up the email.

 Any suggestions?

 Thanks,
 Robbert van Andel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP and XML

2005-10-05 Thread Robbert van Andel
Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM based
installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line.  How do I do this when we did not build
PHP from source?  Is there another way to get XSL activated?

Thanks for your help
Robbert 

-Original Message-
From: Stephen Leaf [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 05, 2005 7:39 PM
To: php-general@lists.php.net
Subject: Re: [PHP] PHP and XML

On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote:
 My company recently installed google's search appliance and I am working
 on some scripts to display the search results on our various websites.
 The problem I'm having is using the XML parsing functions I've used on
 other pages is not working because the returned XML has invalid xml
 characters in it.  For example, the data between the xml tags include
 html tags that are supposed to be displayed.  But when I parse the xml,
 the parse sees these tags as new start tags.  Is there a way to work
 around this or a different way to parse this document?  I've heard a
 little about XSLT really don't know anything about it and am wondering
 if that is the way to deal with it?
XSL can display the contents using a 
xsl:copy-of select=node/
bear in mind tho that it also copies the node name.
example:
nodecopied stuffbr//node

copying only the inner content can be achieved by doing a select=. however

you'll need to have the current node be the one that you want copied.
this can be done by using a
xsl:for-each select=node
xsl:copy-of select=./
/xsl:for-each

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to 
accomplish it.


 Here is a part of the XML returned by the google appliance:
 GSP VER=3.2
 TM0.008398/TM
 Qinformation services/Q
 PARAM name=q value=information services
 original_value=information+services/
 PARAM name=site value=shpolicy original_value=shpolicy/
 PARAM name=client value=shpolicy original_value=shpolicy/
 PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/
 PARAM name=btnG value=Google_Search
 original_value=Google+Search/
 PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/
 PARAM name=access value=p original_value=p/
 -
   RES SN=1 EN=10
 M86/M
 FI/
 -
   NB
 -
   NU

/search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient
=shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU
 /NB
 -
   R N=1 MIME=application/pdf
 -
   U

http://shpolicy.shservices.org/administrative/InformationServices/housewide
applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U
 -
   UE

http://shpolicy.shservices.org/administrative/InformationServices/housewide
applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.
p
df /UE
 -
   T
 bInformation/b bServices/b Software Purchasing
 /T
 RK5/RK
 FS NAME=date VALUE=2005-09-07/
 -
   S
  b.../b Administrative Housewide Policy bInformation/b
 bServices/b Software Purchasing Applicablebr Campus: Salem and
 West Valley Hospitals Department Name: bInformation/b b.../b
 /S
 -
   HAS
 L/
 C SZ= CID=4_wracnOVC8:/
 /HAS
 /R

 I can send the parsing code but it's fairly straight forward and I
 didn't want to needlessly fill up the email.

 Any suggestions?

 Thanks,
 Robbert van Andel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML

2005-10-05 Thread Stephen Leaf
On Wednesday 05 October 2005 09:46 pm, Robbert van Andel wrote:
 Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM
 based installation of PHP version 5.0.4.  I see on PHP.net's website that
 XSL comes standard with PHP 5 and you need to enable it by adding the
 argument --with-xsl to the configure line.  How do I do this when we did
 not build PHP from source?  Is there another way to get XSL activated?

Compiling it from source will be your best choice.
If you have a test server compile it there and create the rpm. then install on 
the production server.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ? PHP in XML document

2005-08-15 Thread Torgny Bjers
Labunski wrote:

Hello,

Is it possible to write some PHP code lines in the XML document?

e.g. I want to add ?php require_once(read_database.php); ? to the xml 
document, but
I don't know the right syntax to do this.

Btw, I need this, cause I'm trying to make CMS system for Flash page.


The easiest way to do this in Flash is to call a PHP script instead of
an XML file in Flash, that way you can render the XML document however
you want with PHP and load data directly from the database into XML or
whatever you wish. So, replace the XML filename for your PHP script, and
that way you should be able to add querystrings and whatnot too.

Regards,
Torgny

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ? PHP in XML document

2005-08-14 Thread Labunski
Hello,

Is it possible to write some PHP code lines in the XML document?

e.g. I want to add ?php require_once(read_database.php); ? to the xml 
document, but
I don't know the right syntax to do this.

Btw, I need this, cause I'm trying to make CMS system for Flash page.

Thanks a lot!
Roman 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP-based XML utilities

2004-06-23 Thread Jason Barnett
Hey all, I've been working a lot more with XML recently and it seems 
like there's been a fair number of other people using XML too (based on 
the moderate number of XML-based problems showing up on this list).  So, 
I thought I might build a form with PHP that helps people trying to work 
with XML documents.

If people are interested, I'll publish the source online (not on this 
list).  But if I'm going to do that, I need to know what features people 
would find most helpful for their XML development / debugging.

The list of form features that seem most helpful to me:
- Simple creation of xml nodes.
- XML function reference.  I'm thinking I will just link to PHP's online 
documentation here.
- Full qname expansion.  Some xml documents use namespaces; with this 
users can click on a localname and see the resolved qname.
- XPath highlighting.  Enter an XPath expression for your document, and 
the script returns the source with all matching nodes highlighted.
- Validation, with syntax highlighting when an error is found.

I also might do:
- XSLT function reference.
- Before  after snapshots of an XSL transformation on a given xml 
document.  Perhaps this would also allow the user to click on one of the 
xml nodes from the new document and see which transformation affected 
this node.

By creating an html form to handle this generation, I'm hoping that 
myself and other people will be able to solve more of their xml problems 
on their own.  Comments?  Suggestions?

Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP en XML een vraag waard

2004-06-14 Thread De Saedeleer Yves
Gegroet,
Hoi

Ik ben reeds een tijdje bezig met PHP en hier en daar lukt er al eens iets
:=))

 Maar nu stuit ik toch op een probleempje.
 Ik moet voor een siteje XML data gaan parsen die bekomen wordt uit een URL.

 Als ik deze URL in een browser invoer dan krijg ik XML code terug.

 Mijn vraag is nu:
 Welke code moet ik gaan in voeren (instuderen) om de aldus bekomen gevens
om
 te zetten in bruikbare data voor het gebruyik in PHP.

 ik voer in de browser het volgende in:
 http://www.websiote.com/xml/xmlonl.asp?custid=CustIDprodid=ProdID

 en dan krijg ik iets in de zin van de data hieronder terug:

   ?xml version=1.0 ?
 - RealData
   MSG ID=0ok/MSG
 - ITEM
   ID876607/ID
   DESCAntec Aluminium Midi Tower 4x5,25 2x3,5 USB amp; IEEE1394 amp;
 audio 2x120mm fan NO PSU/DESC
   PRICE CURRENCY=EUR103,3/PRICE
   QTY32/QTY
   DELDATE15062004/DELDATE
   /ITEM
   /RealData

 wat ik hieruit nodig heb zijn de volgende gegevens:
 het veld QTY, PRICE CURRENCY en het veld DELDATE

 ik heb totaal geen ervaring met de combinatie PHP en XML.
 Alle hulp is meer dan welkom.


 Yves,



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP en XML een vraag waard

2004-06-14 Thread Dennis Seavers
42.


 [Original Message]
 From: De Saedeleer Yves [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Date: 06/14/2004 1:28:28 PM
 Subject: [PHP] PHP en XML een vraag waard

 Gegroet,
 Hoi

 Ik ben reeds een tijdje bezig met PHP en hier en daar lukt er al eens iets
 :=))

  Maar nu stuit ik toch op een probleempje.
  Ik moet voor een siteje XML data gaan parsen die bekomen wordt uit een
URL.

  Als ik deze URL in een browser invoer dan krijg ik XML code terug.

  Mijn vraag is nu:
  Welke code moet ik gaan in voeren (instuderen) om de aldus bekomen gevens
 om
  te zetten in bruikbare data voor het gebruyik in PHP.

  ik voer in de browser het volgende in:
  http://www.websiote.com/xml/xmlonl.asp?custid=CustIDprodid=ProdID

  en dan krijg ik iets in de zin van de data hieronder terug:

?xml version=1.0 ?
  - RealData
MSG ID=0ok/MSG
  - ITEM
ID876607/ID
DESCAntec Aluminium Midi Tower 4x5,25 2x3,5 USB amp; IEEE1394
amp;
  audio 2x120mm fan NO PSU/DESC
PRICE CURRENCY=EUR103,3/PRICE
QTY32/QTY
DELDATE15062004/DELDATE
/ITEM
/RealData

  wat ik hieruit nodig heb zijn de volgende gegevens:
  het veld QTY, PRICE CURRENCY en het veld DELDATE

  ik heb totaal geen ervaring met de combinatie PHP en XML.
  Alle hulp is meer dan welkom.


  Yves,



 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML.

2004-02-02 Thread Mark Ackroyd


Rolf Brusletto wrote:

The only thing I can think of is apache/you_webserver_here is limiting 
the amount of memory.. still an odd problem though, depending on the 
size of the xml..
The XML is tiny, 12 lines.  I got round the problem by chopping up 
someone elses PHP XML parser script, so that it wasn`t using expat.

Wich I had time to look into all of these little things :-)

--
Mark Ackroyd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP and XML.

2004-01-30 Thread Mark Ackroyd
Odd problem.

I have written a small script that processes some XML, it runs on a few 
FreeBSD boxes I admin over. On one of the boxes (the only one) .. if I 
run this script through apache, The xml_set_element_handler and 
xml_set_character_data_handler functions return a 1 error (out of memory)

If I run the scripts from the Command lime they work fine !

anyone got any ideas?

Mark

--
Mark Ackroyd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP and XML.

2004-01-30 Thread Rolf Brusletto
Mark Ackroyd wrote:

Odd problem.

I have written a small script that processes some XML, it runs on a 
few FreeBSD boxes I admin over. On one of the boxes (the only one) .. 
if I run this script through apache, The xml_set_element_handler and 
xml_set_character_data_handler functions return a 1 error (out of memory)

If I run the scripts from the Command lime they work fine !

anyone got any ideas?

Mark


**always be careful when using the command lime :D

j/k

The only thing I can think of is apache/you_webserver_here is limiting 
the amount of memory.. still an odd problem though, depending on the 
size of the xml..



--
Rolf Brusletto
rolf[at]emailfeeds[dot]com
http://www.emailfeeds.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP and XML.

2004-01-30 Thread Raditha Dissanayake
I agree with Rolf, What's really suprising though is that SAX parsers 
use very little memory in the first place.

Rolf Brusletto wrote:

Mark Ackroyd wrote:

Odd problem.

I have written a small script that processes some XML, it runs on a 
few FreeBSD boxes I admin over. On one of the boxes (the only one) .. 
if I run this script through apache, The xml_set_element_handler and 
xml_set_character_data_handler functions return a 1 error (out of 
memory)

If I run the scripts from the Command lime they work fine !

anyone got any ideas?

Mark


**always be careful when using the command lime :D

j/k

The only thing I can think of is apache/you_webserver_here is limiting 
the amount of memory.. still an odd problem though, depending on the 
size of the xml..





--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP and XML help needed

2003-09-11 Thread Mr. Bogomil Shopov
Hi folks
How I can put some php code in a XSL template.
I have a function that returns a value and I want this value to be entered
in a  img tag in XSL template?

Thanks
Bogomil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and XML help needed

2003-09-11 Thread Raditha Dissanayake
Hi Mr Bogomil,

IMHO you should try to do this with xsl:if/ most things that look like 
it should be delegated to php can in fact be done easily with
xsl:if/ or xsl:choose/

best regards
raditha


Mr. Bogomil Shopov wrote:

Hi folks
How I can put some php code in a XSL template.
I have a function that returns a value and I want this value to be entered
in a  img tag in XSL template?
Thanks
Bogomil
 



--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP with XML on Windows XP

2003-07-24 Thread Sam
I have recently upgraded a server which I use for development:
Windows XP Home
Apache 1.3.26
MySQL 3.23
PHP 4.3.2 with Pear

Everything seemed to go well, except that now I James Clarks expat does
not work.  Very confused on this one I have uninstalled expat and
re-installed
Trying different versions including the latest release all to no avail.
PHPInfo lists the extension as being installed although any script using
the extension never manages to load.  The expat extension works out of
the box with php I would prefer to not have to reinstall php since I
have configured xslt which was not a lot of fun.

SS aka Fru2ty

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and XML-RPC on MS Windows

2003-06-11 Thread Erich Kolb
What do I have to do in order to use the XML-RPC functionality on a Windows
based machine?  It was fairly easy to drop the .inc files into the PHP
include directory on a Linux box, but I am not sure if it is possible to do
the same on a Windows machine.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP DOM XML Function

2003-03-14 Thread Fatih stnda
do you have any idea about PHP DOM XML functions?
when will PHP DOM XML functions be stable?


Fatih stnda
Yre Elektronik Yaymclk A..
0 212 234 00 90


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and XML mailing list

2003-01-24 Thread Sterling Hughes
A mailing list for discussing the future of PHP and XML development has
been created.  You can subscribe by sending a message to
[EMAIL PROTECTED] (normal ezmlm commands apply).  This
mailing list is _only_ intended for actual php extension and api
development, user support questions should remain on
[EMAIL PROTECTED]

-Sterling

-- 
Nothing is particularly hard if you divide it into small jobs. 
- Henry Ford


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php obj - xml ?

2003-01-15 Thread neko
Just wanted some opinions on the best way to produce well-formed xml from a 
php object. In my case, I was toying with the idea of a generic way to 
product an xml file from a PEAR DataObject - the idea being that a 3rd 
party requests data, I extract from mysql using Pear's DataObjects, then 
tell that objects to produce xml (or pass it to a transformer or 
something).

Links? Ideas? Recommendations from RL experience?

cheers,
neko

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML parser (expat)

2002-12-29 Thread Lasse Tarp
Hello PHP.

I'm running Linux Mandrake 9.0 with Apache 1.3.26 and PHP 4.2.3 and I'm
trying to get the XML parser expat to work. I get this error:
Call to undefined function: xml_parser_create()
I have installed expat from the Mandrake Control center, but I dont
think PHP found that out  :-)
I checked out the manual and found a tip:
libexpat.a: $(OBJS)
ar -rc $@ $(OBJS)
ranlib $@
but i do not know what to do with it ?

How do I get the XML parser to work with PHP ???

Kind Regards Lasse Tarp





[PHP] php and xml

2002-08-27 Thread Alia Mikati

Hello
What's the best to convert HTML to XML that I can use in PHP
Thx a lot



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php and xml problem

2002-08-14 Thread Pafo

i got 2 problems with this code:

?php
$insideitem = false;
$insidekeep = false;
$insiderelic = false;
$printed = false;
$printedkeep = false;
$tag = ;
$server = false;
$da_server = ;
$da_lastguildupdate = ;
$da_lastcharupdate = ;
$da_population = ;
$da_type = ;
$da_status = ;
$da_relicorig = ;
$da_relicname = ;
$da_relictype = ;
$da_relicowner = ;
$da_keeporig = ;
$da_keepname = ;
$da_keepowner = ;
$da_keepclaimant = ;


function startElement($parser, $tagName, $attrs) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_type,
$da_lastguildupdate, $da_lastcharupdate, $server, $da_relictype,
$da_relicname, $da_relicorig, $da_keepname, $da_keeporig;

 if ($insideitem || $insiderelic || $insidekeep) {
  $tag = $tagName;
 }

   elseif ($tagName == SERVER) {
 $insideitem = true;

// PROBLEM 1, LOOK BELOW FOR DESCRIPTION!
 while (list ($key, $val) = each ($attrs)) {
 if ($key == NAME  $val == Guinevere) { $server = true;  $da_server =
$val; print Sant, $key - $val; }
 else { $server = false; }
 } // end WHILE
// ENDS HERE!!!

 if ($server) {
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
   case TYPE : $da_type = $val; break;
   case LASTGUILDUPDATE : $da_lastguildupdate = $val; break;
   case LASTCHARUPDATE : $da_lastcharupdate = $val; break;
  }
   } // end WHILE
   }
   }

// PROBLEM 2,, LOOK BELOW FOR DESCRIPTION!
   elseif ($tagName == RELIC  $server) {
 $insiderelic = true;
 while (list ($key, $val) = each ($attrs)) {
   if ($key == TYPE) { $da_relictype = $val; }
 if ($key == NAME) { $da_relicname = $val; }
 if ($key == REALM) { $da_relicorig = $val; }
 } // End While
 }
// ENDS HERE!!!

   elseif ($tagName == KEEP  $server) {
   $insidekeep = true;
 while (list ($key, $val) = each ($attrs)) {
   if ($key == NAME) { $da_keepname = $val; }
 if ($key == REALM) { $da_keeporig = $val; }
 } // End While
 }
}


function characterData($parser, $data) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_population,
$da_status, $da_relicowner, $da_keepowner, $da_keepclaimant;
 if ($insideitem) {
switch ($tag) {
  case POPULATION: $da_population .= $data; break;
  case STATUS: $da_status .= $data; break;
  }
 }
 if ($insiderelic) {
  $da_relicowner .=  $data;
 }
 if ($insidekeep) {
switch ($tag) {
  case OWNER :  $da_keepowner .=  $data; break;
  case CLAIMANT : $da_keepclaimant .= $data; break;
}
 }
}


function endElement($parser, $tagName) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_server,
$da_population, $da_type, $da_status, $da_lastguildupdate,
$da_lastcharupdate, $da_relicname, $da_relicowner, $da_relicorig,
$da_relictype, $printed, $printedkeep, $da_keeporig, $da_keepname,
$da_keepowner, $da_keepclaimant;
 if ($tagName == SERVER  $server == true) {
  print
TRTDbServer/b/TDTDbStatus/b/TDTDbPopulation/b/TD
/TR\n;
  print TRTD$da_server;
  if ($da_type) { print (i$da_type/i); }
  print /TD;
  print TD$da_status/TD;
  print TD$da_population/TD/TR\n;
  print TRTD/TD/TR\n;
  print
TRTDbLastguildupdate/b/TDTDbLastcharupdate/b/TDTD/TD
/TR\n;
  print
TRTD$da_lastguildupdate/TDTD$da_lastcharupdate/TD/TR\n;
 }
 elseif ($tagName == RELIC  $server == true) {
  if (!$printed) { print TRTD/TD/TR\n; print TRTDbRelic
Name/b/TDTDbRelic Owner/b/TDTDbRelic Type/b/TD/TR\n;
$printed = true; }
  print TRTD;
  if ($da_relicorig == Albion) { print font
color=\#ff$da_relicname/font; }
  elseif ($da_relicorig == Midgard) { print font
color=\#ff$da_relicname/font; }
  else { print font color=\#00ff00$da_relicname/font; }
  print /TDTD;
  if ($da_relicowner == Albion) { print font
color=\#ff$da_relicowner/font; }
  elseif ($da_relicowner == Midgard) { print font
color=\#ff$da_relicowner/font; }
  else { print font color=\#00ff00$da_relicowner/font; }
  print /TDTD$da_relictype/TD/TR\n;
 }
 elseif ($tagName == KEEP  $server == true) {
  if (!$printedkeep) {  print TRTD/TD/TR\n; print TRTDbKeep
Name/b/TDTDbKeep Owner/b/TDTDbClaimant/b/TD/TR\n;
$printedkeep = true; }
  print TRTD;
  if ($da_keeporig == Albion) { print font
color=\#ff$da_keepname/font; }
  elseif ($da_keeporig == Midgard) { print font
color=\#ff$da_keepname/font; }
  else { print font color=\#00ff00$da_keepname/font; }
  print /TDTD;
  if ($da_keepowner == Albion) { print font
color=\#ff$da_keepowner/font; }
  elseif ($da_keepowner == Midgard) { print font
color=\#ff$da_keepowner/font; }
  else { print font color=\#00ff00$da_keepowner/font; }
  print /TDTD$da_keepclaimant/TD/TR\n;
 }

  $da_server = ;
  $da_lastguildupdate = ;
  $da_lastcharupdate = ;
  $da_population = ;
  $da_type = ;
  $da_status = ;
  $da_relicorig = ;
  $da_relicname = ;
  $da_relictype = ;
  $da_relicowner = ;
  $da_keeporig = ;
  $da_keepname = ;
  $da_keepowner = ;
  $da_keepclaimant = ;
  $insideitem = false;
  $insiderelic = false;
  $insidekeep = false;
}



// gotta have this for the php-NUKE block stuff to work
global $da_totalpop;

// Create an XML 

Re: [PHP] PHP and XML Resources

2002-07-05 Thread Analysis Solutions

Hola:

On Thu, Jul 04, 2002 at 01:12:26PM -0600, CM wrote:

 Can anyone recommend a good book or web page on php and xml?
 The Professional PHP4 XML book by wrox looks good but I haven't read any
 reviews on it.

I have a demonstration page at
http://www.analysisandsolutions.com/code/phpxml.htm

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML Resources

2002-07-04 Thread CM

Can anyone recommend a good book or web page on php and xml?
The Professional PHP4 XML book by wrox looks good but I haven't read any
reviews on it.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP parsing XML from Shoutcast

2002-05-19 Thread Johan Ekström

Anyone that has knowledge about this program, regarding it's XML output and
php fetching that info and placing it on a php-page for user's to view?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Php and XML

2002-04-29 Thread Philip Yeo

Hi there,

I would like to create an XML parser using Php. Any good references for doing this??

Philip



[PHP] Php and XML

2002-04-29 Thread Philip Yeo

Hi there,

I would like to create an XML parser using Php. Any good references for
doing this??

Philip



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML-QL/XQuery

2002-04-12 Thread Alia Mikati

Hi
I'm searching for an XML-QL/XQuery engine or module for PHP. Does anyone 
have any idea where I can find it?
Thx a lot



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL/XML

2002-04-01 Thread Erik Price


On Monday, April 1, 2002, at 02:33  PM, Jay Fitzgerald wrote:

 Can this be done and am I going about it the right way?

First, it's a bad idea to cross-post between mailing lists, even if they 
seem like related topics.  Second, what is it you're trying to do?  Or 
what does your application do?


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL/XML

2002-04-01 Thread Thalis A. Kalfigopoulos

On Mon, 1 Apr 2002, Jay Fitzgerald wrote:

 I have created a database called friends with four columns:
 Name / Address / City / State
 
 I also made an XML file to coincide with those variables:
 test
  contacts
  friends
  nameFriend 1/name
  address999 Foo Avenue/address
  cityFoo Town/city
  stateFO/state
  /friends
  /contacts
 /test
 
 The variables in the XML doc above are already in the database
 
 
 BUT - what I want to do - using PHP and MySQL - is something like this:
 
 $connection = mysql_connect(localhost, foo, bar) or die (Could not 
 connect to server.);
 $db = mysql_select_db(friends) or die (Could not select database.);
 $sql = select * from friends order by name asc;
 $sql_result = mysql_query($sql, $connection) or die (Could not execute 
 query.);
 
 echo ?xml version=\1.0\ encoding=\ISO-8859-1\?\n;
 echo ?xml-stylesheet type=\text/xsl\ href=\friends.xsl\?\n\n;
 
 echo test\n;
 echo \tcontacts\n;
 echo \t\tfriends\n;
 
 echo \t\t\tname;
 echo $name;
SNIP
 Can this be done and am I going about it the right way?

It's not clear what would be right in your case because you don't state what you'd 
like the code to do for you. But anyway, the extraction from the DB is not complete 
(neep more PHP code after you get the result handler). From the way that you have your 
SQL query, it seems that you have a table with columns name/address/city/state. If XML 
is not your only output format, then that's OK. But if this data will see the light of 
day only as XML, then you might as well store it as plain text in a single field. Of 
couse you won't be able to order by the name on the SQL side this way :-) But you can 
parse the entries on the PHP side after you retrieve them and then sort them.

Just my 2c.

cheers,
--thalis


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL/XML

2002-04-01 Thread Erik Price


On Monday, April 1, 2002, at 02:33  PM, Jay Fitzgerald wrote:

 Can this be done and am I going about it the right way?

Are you familiar with something called partial decomposition?  I'm not 
sure where it came from, but Google suggests that it may have been 
conceived by Daniel Appelquist, the author of a book called XML and 
SQL.  I read this book a few weeks ago -- it's expensive, and slim on 
content (see my mini-review below), but covers a topic that everyone 
seems very interested in.  I was elated when Google pointed me to this 
article on the theory of partial decomposition (by Appelquist) but 
dismayed to find that he didn't submit it in time for a conference, and 
so it is not actually found at this link: 
http://www.idealliance.org/papers/xml2001/papers/html/06-05-02.html
But I'm sure it's the same idea he puts forth in his book.

Partial Decomposition:
The idea is that you store your information in an XML document, and then 
take the most-searched information and store it in a database with some 
kind of relationship to the document (either store the XML document in 
the database or store a URI to the XML document in the database).  In 
this fashion, you can use the power of SQL to search for your data, but 
have the data itself stored in XML to take advantage of XML's features.  
The important thing to remember is that the data in the columns should 
ONLY be used for searches, and the XML is where the data TRULY lies, 
otherwise you can violate data integrity.  It is not a good scheme for 
data that is regularly changed or updated -- for this you are better off 
storing your data in the usual way.  Also, some of the methods for 
ensuring data integrity are not at this time possible in MySQL (he uses 
Oracle and SQL Server for a lot of his examples), though you can ad-lib 
it with your application (i.e. in PHP) if you are dilligent and are 
careful not to make changes to your database without going through the 
proper channels to ensure that data integrity is maintained.

It is no substitute for a true XML database, since it is just that -- a 
partial decomposition of your data (and thus is only partially 
searchable), and won't work for every application.  But you may wish to 
check out Appelquist's book.

(* my mini-review of XML and SQL by Daniel Appelquist:  Well, there 
aren't a lot of pages, the text is huge, and the book still costs US 
$40.00.  Kind of ridiculous.  This is further exacerbated by the fact 
that only 80% of the book actually revolves around ideas of using XML 
with SQL, and much of the rest of the book focuses on the process of 
developing a web application by taking user surveys and 
scenario-role-playing etc, or introducing some of the fundamentals of 
XML which are available all over the rest of the bookstore.  Excellent 
topics, which IMHO do not fall under the topic of 'XML and SQL'.  The 
book also discusses at length some of the XML features of Oracle and SQL 
Server, so I kind of skipped over these sections -- I'm a MySQL fan.

Is it worth reading?  The middle few chapters, which deal specifically 
with partial decomposition, are interesting.  But is it worth $40?  Not 
unless your employer is paying for it, or if you are looking for a 
general book on developing web applications.  In fact, it should 
probably have been called Developing Web Applications with XML and 
SQL, and if it had then this review might be more forgiving.)

To answer your question, I'm not so sure that I would go about it the 
way that you have -- it seems that you are echoing an XML file from SQL 
information.  There's nothing wrong with this, but simply echoing it to 
the screen is probably more useless than just echoing the data in some 
meaningful format -- such as a paragraph or a list.  HOWEVER, if you 
were  storing the data in a file, or a string to be sent out as a SOAP 
or XML-RPC request, then that makes more sense.

Still, you want some advice?  First, your SQL code won't work as it 
is -- you've forgotten a mysql_fetch_* function to pull the data from 
the $sql_result.  So, add to your code:

while ($xml_data_row = mysql_fetch_assoc($sql_result)) {
   $xml_document = '?xml version=1.0 encoding=utf-8 ?
test
   contacts
 friends
   name' . $xml_data_row['name'] . '/name
   address' . $xml_data_row['address'] . '/address
   city' . $xml_data_row['city'] . '/city
   state' . $xml_data_row['home'] . '/state
 /friends
   /contacts
/test
;

echo $xml_document;
}

This saves you a ton of typing and even makes your code look better.

HTH,


Erik




Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP/MySQL/XML

2002-04-01 Thread Erik Price

Shoot, kind of an important error I made in the code I gave you 
earlier -- the closing quote for $xml_document should be a single-quote, 
not a double-quote as I wrote.

Sorry,
Erik




On Monday, April 1, 2002, at 04:26  PM, Erik Price wrote:

 Still, you want some advice?  First, your SQL code won't work as it 
 is -- you've forgotten a mysql_fetch_* function to pull the data from 
 the $sql_result.  So, add to your code:

 while ($xml_data_row = mysql_fetch_assoc($sql_result)) {
   $xml_document = '?xml version=1.0 encoding=utf-8 ?
 test
   contacts
 friends
   name' . $xml_data_row['name'] . '/name
   address' . $xml_data_row['address'] . '/address
   city' . $xml_data_row['city'] . '/city
   state' . $xml_data_row['home'] . '/state
 /friends
   /contacts
 /test
 ;








Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP/MySQL/XML

2002-04-01 Thread Jay Fitzgerald

I have created a database called friends with four columns:
Name / Address / City / State

I also made an XML file to coincide with those variables:
test
 contacts
 friends
 nameFriend 1/name
 address999 Foo Avenue/address
 cityFoo Town/city
 stateFO/state
 /friends
 /contacts
/test

The variables in the XML doc above are already in the database


BUT - what I want to do - using PHP and MySQL - is something like this:

$connection = mysql_connect(localhost, foo, bar) or die (Could not 
connect to server.);
$db = mysql_select_db(friends) or die (Could not select database.);
$sql = select * from friends order by name asc;
$sql_result = mysql_query($sql, $connection) or die (Could not execute 
query.);

echo ?xml version=\1.0\ encoding=\ISO-8859-1\?\n;
echo ?xml-stylesheet type=\text/xsl\ href=\friends.xsl\?\n\n;

echo test\n;
echo \tcontacts\n;
echo \t\tfriends\n;

echo \t\t\tname;
echo $name;
echo \t\t\t/name\n;

echo \t\t\taddress;
echo $address;
echo \t\t\t/address\n;

echo \t\t\tcity;
echo $city;
echo \t\t\t/city\n

echo \t\t\tstate;
echo $home;
echo \t\t\t/state\n;

echo \t\t/friends;
echo \t/contacts;
echo /test;

?



Can this be done and am I going about it the right way?




Should you have any questions, comments or concerns, feel free to call me 
at 318-338-2034.

Thank you for your time,

Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
==
Bayou Internet..(888) 
30-BAYOUhttp://www.bayou.com
Mississippi Internet...(800) 
MISSISSIPPI...http://www.mississippi.net
Vicksburg Online..(800) 
MISSISSIPPIhttp://www.vicksburg.com
==
Tel: (318) 338-2034ICQ: 38823829 Fax: 
(318) 323-5053



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Dennis Moore

I am looking for opinions and other philosophy on a couple of XML issues.  I have my 
own opinion, but I am curious what others think and what they are doing...

I am in the process of updating many of my applications to include XML/XLST/ and/or 
WDDX technologies.   Many of my applications read a static configuration file which 
assigns values to variables and arrays.   If we need to change something we manually 
edit the configuration files.  In some instances, we have written web interfaces to 
manage these configuration files.  

I am in a dilemma right now between If it ain't broke, don't fix it and Looking 
over my shoulder.  I am trying to determine whether it makes more sense to use XML 
for maintaining configuration files.  

As far as content management, we use static include files or MySQL databases to store 
site content.   I am not sure where the advantage of using XML/XLST for this 
functionality.   

Please comment.



Re: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Erik Price


On Friday, March 29, 2002, at 12:52  PM, Dennis Moore wrote:

 I am in the process of updating many of my applications to include
 XML/XLST/ and/or WDDX technologies.   Many of my applications read a
 static configuration file which assigns values to variables and arrays.
 If we need to change something we manually edit the configuration files.
 In some instances, we have written web interfaces to manage these
 configuration files.

 I am in a dilemma right now between If it ain't broke, don't fix it
 and Looking over my shoulder.  I am trying to determine whether it
 makes more sense to use XML for maintaining configuration files.

 As far as content management, we use static include files or MySQL
 databases to store site content.   I am not sure where the advantage of
 using XML/XLST for this functionality.

In my experience, you're going to get a lot of anti-XML responses about 
this.  My limited experience of dealing with XML is that it is very 
complicated and difficult to actually do, regardless of the promises of 
simplicity that are usually made when discussing XML.  HOWEVER -- once 
your application is all set up, I imagine that it will actually be 
somewhat easier to maintain.  It's learning how to do all of this, plus 
the fact that the XML tech is so young right now.  For instance, check 
out the man page on xslt_set_sax_handler() or xslt_set_sax_handlers() -- 
not very informative.  And while xslt_process() has a man page that 
actually explains how to use it, it really helps to have a more 
fundamental understanding of XSLT, since it is not explained in the man 
page why you use the argument syntax that is used.

I just discovered this last one last night... so you might have seen the 
thread.  I think it's interesting, and I'm trying to incorporate it into 
my app even though it DEFINITELY doesn't need this kind of 
functionality, because I want to learn more about it.  In fact, if 
performance or high volume are issues to you, then you should probably 
hold off for now, as most of these functions require quite a bit of 
processing -- XML was never intended to be lean or mean.

Probably the hardest thing is finding resources on this -- there are 
quite a few tutorials on DevShed or SitePoint or PHPBuilder that do a 
good job of introducing a topic, and there are some books on XML itself, 
and its related technologies, but I haven't found much that goes 
in-depth into using PHP with XML.  There is far more about Java and XML 
than PHP.  I finally found a mailing list devoted to PHP/XML issues, but 
it's on Yahoo! Groups and I'm having a bitch of a time getting 
subscribed (who ever thought that a web-based interface for mailing list 
management was a good idea?)

Anyway, best of luck to you -- let me know if you find a community 
dedicated to this very topic, since I'd like to focus on it a bit more.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread J. Scott Johnson

Just to follow up on some of these thoughts.

XML is definitely complicated to move into.  Its unclear if you aren't
involved in data interchange, if the benefits are really there.  If you are
just developing in your own way, you may not need it.  OTOH, its new, sexy
and may sell better to your customers (if you have such).  Bear in mind
that if you are db backed, you still need to flatten to store in a DB.
There aren't many XML stores, most aren't that good, and they aren't that
fast.  With that said, I am doing XML now but its for data interchange, not
anything else.

NOTE -- I was doing SGML in 89 and XML ain't all that different.

Scott

* * * * * * * * * * * * * * * * * * * * * * * * * *
J. Scott Johnson
PHP Consulting and Design Work
* * * * * * * * * * * * * * * * * * * * * * * * * *
Virtual:
* * * * * * * * * * * * * * * * * * * * * * * * * *
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 12:54 PM
To: Dennis Moore
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP and XML/XLST/WDDX etc



On Friday, March 29, 2002, at 12:52  PM, Dennis Moore wrote:

 I am in the process of updating many of my applications to include
 XML/XLST/ and/or WDDX technologies.   Many of my applications read a
 static configuration file which assigns values to variables and arrays.
 If we need to change something we manually edit the configuration files.
 In some instances, we have written web interfaces to manage these
 configuration files.

 I am in a dilemma right now between If it ain't broke, don't fix it
 and Looking over my shoulder.  I am trying to determine whether it
 makes more sense to use XML for maintaining configuration files.

 As far as content management, we use static include files or MySQL
 databases to store site content.   I am not sure where the advantage of
 using XML/XLST for this functionality.

In my experience, you're going to get a lot of anti-XML responses about
this.  My limited experience of dealing with XML is that it is very
complicated and difficult to actually do, regardless of the promises of
simplicity that are usually made when discussing XML.  HOWEVER -- once
your application is all set up, I imagine that it will actually be
somewhat easier to maintain.  It's learning how to do all of this, plus
the fact that the XML tech is so young right now.  For instance, check
out the man page on xslt_set_sax_handler() or xslt_set_sax_handlers() --
not very informative.  And while xslt_process() has a man page that
actually explains how to use it, it really helps to have a more
fundamental understanding of XSLT, since it is not explained in the man
page why you use the argument syntax that is used.

I just discovered this last one last night... so you might have seen the
thread.  I think it's interesting, and I'm trying to incorporate it into
my app even though it DEFINITELY doesn't need this kind of
functionality, because I want to learn more about it.  In fact, if
performance or high volume are issues to you, then you should probably
hold off for now, as most of these functions require quite a bit of
processing -- XML was never intended to be lean or mean.

Probably the hardest thing is finding resources on this -- there are
quite a few tutorials on DevShed or SitePoint or PHPBuilder that do a
good job of introducing a topic, and there are some books on XML itself,
and its related technologies, but I haven't found much that goes
in-depth into using PHP with XML.  There is far more about Java and XML
than PHP.  I finally found a mailing list devoted to PHP/XML issues, but
it's on Yahoo! Groups and I'm having a bitch of a time getting
subscribed (who ever thought that a web-based interface for mailing list
management was a good idea?)

Anyway, best of luck to you -- let me know if you find a community
dedicated to this very topic, since I'd like to focus on it a bit more.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Rich Buggy

 I am in a dilemma right now between If it ain't broke, don't fix it and
Looking
 over my shoulder.  I am trying to determine whether it makes more sense
to use
 ML for maintaining configuration files.

  Compiled program == ML configuration file
  Interpreted program (i.e PHP) == included configuration file with
variables set

  For most interpreted programs I can't see any advantage in adding extra
code and processing time just to store the config file in a ML.

 As far as content management, we use static include files or MySQL
databases to
 store site content.   I am not sure where the advantage of using XML/XLST
for this
 functionality.

  I'm currently working on a class library/application framework for PHP
(similar to Delphi's VCL) in which I'm using XML/XSLT for the templates.
It's working great with development not taking very long at all. The two
main advantages of using XML/XSLT for content management that I can see are:
1. It's easier to enforce a common look and feel on a site.
2. It's easier to re-target content (different transformations for
different browsers).
.

  Rich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php, win32, xml bug?

2002-02-25 Thread Alexander Gräf


hi,

when im using xsl:output encoding=ISO-8859-1 i get

Sablotron error on line 1: unknown encoding 'ISO-8859-1' in  on line ...

but i think iso-8859-1, utf-8, etc. support must be build in. in addition,
when i try to include an external xsl with xsl:include href=... / or a
xml file with document(), no matter what encoding the target-file has, i
get the following error:

Sablotron error on line 1: unknown encoding '' in  on line ...

yes, the position where the unknown encoding has to appear is empty, he says
he does not know an unknown encoding ... how can i use the including
functions, and how can i use iso-8859-1 as output encoding (the only
workarround would be to convert the output encoding from utf-8 to iso-8859-1
with iconv, but this isnt the way i thought a xml-parser has to work ...)

configuration:

apache:
Server Version: Apache/1.3.23 (Win32) PHP/4.1.1 DAV/1.0.3-dev
Server Built: Jan 24 2002 20:30:48

server:
Windows 2000 Server, SP2
2 GB RAM, dual-xeon 933 mhz

php-info:
System: Windows NT 5.0 build 2195
Build Date: Dec 30 2001
Thread Safety: enabled
ZEND_DEBUG: enabled
Configuration File (php.ini) Path: C:\WINNT\php.ini
Virtual Directory Support: enabled

This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies
with Zend Optimizer v1.2.0, Copyright (c) 1998-2001, by Zend
Technologies

XSLT support: enabled
iconv support: enabled
XML Support: active
XML Namespace Support: active
EXPAT Version: 1.95.2


;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for
it.
;
;extension=php_bz2.dll
;extension=php_ctype.dll
extension=php_cpdf.dll
extension=php_curl.dll
;extension=php_cybercash.dll
;extension=php_db.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
extension=php_domxml.dll
;extension=php_dotnet.dll
;extension=php_exif.dll
;extension=php_fbsql.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd.dll
;extension=php_gettext.dll
;extension=php_hyperwave.dll
extension=php_iconv.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_ingres.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_printer.dll
;extension=php_sablot.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
extension=php_sockets.dll
;extension=php_sybase_ct.dll
extension=php_xslt.dll
;extension=php_yaz.dll
extension=php_zlib.dll



thanks in advance
alex

__

alexander gräf
[EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP and XML

2002-02-04 Thread Sandeep Murphy

If its parsing xml using PHP is what u r looking for, chk out:

http://www.phpbuilder.com/columns/joe2907.php3

http://www.zend.com/zend/art/parsing.php

http://www.melonfire.com/community/columns/trog/archives.php



-Original Message-
From: Peter J. Schoenster [mailto:[EMAIL PROTECTED]]
Sent: segunda-feira, 4 de Fevereiro de 2002 3:24
To: [EMAIL PROTECTED]
Subject: [PHP] PHP and XML


Hi,

I'd appreciate any pointers you recommend to good sources of 
information on how to use PHP and XML. 

Thanks,

Peter

---
Reality is that which, when you stop believing in it, doesn't go
away.
-- Philip K. Dick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML

2002-02-03 Thread Peter J. Schoenster

Hi,

I'd appreciate any pointers you recommend to good sources of 
information on how to use PHP and XML. 

Thanks,

Peter

---
Reality is that which, when you stop believing in it, doesn't go
away.
-- Philip K. Dick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and XML

2001-11-29 Thread Tom Malone

Can anyone recommend a good book on XML, maybe from a PHP perspective?

Tom Malone



-- 
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]




Re: [PHP] PHP and XML

2001-11-29 Thread Brian White

You could try XML for Dummies as a starting point - I have it on my desk
and I have yet to read it in depth but it looks like it explains most 
things OK,
and it has the advantage for PHP folk that it is aimed at people who already
know alot about how HTML works.


At 19:13 29/11/2001 -0500, Tom Malone wrote:
Can anyone recommend a good book on XML, maybe from a PHP perspective?

Tom Malone



--
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]

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



-- 
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]




RE: [PHP] PHP and XML

2001-11-29 Thread Robert Samuel White

XML By Example Second Edition, published by Que, written by Benoit
Marchal, is the best resource out there in my opinion.  This book was
used in one of my college courses.

-Original Message-
From: Tom Malone [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, November 29, 2001 7:13 PM
To: PHP List
Subject: [PHP] PHP and XML


Can anyone recommend a good book on XML, maybe from a PHP perspective?

Tom Malone



-- 
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]




-- 
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]




Re: [PHP] PHP with XML

2001-10-24 Thread Tamas Arpad

On Tuesday 23 October 2001 21:17, Vinicius Tavares wrote:
 What I have to do to make the PHP4 run the DOM XML???
Download the libxml library (the development packages too, if you 
download the packaged distrib). 
And compile php with it (--with-dom switch for configure).

http://www.xmlsoft.org

Arpi

-- 
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]




[PHP] PHP with XML

2001-10-23 Thread Vinicius Tavares


What I have to do to make the PHP4 run the DOM XML???

thanks

Vinicius

-- 
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]




Re: [PHP] PHP with XML

2001-10-23 Thread Tim

On Tue, 2001-10-23 at 15:17, Vinicius Tavares wrote:
 
 What I have to do to make the PHP4 run the DOM XML???


http://www.php.net/manual/en/ref.domxml.php


-- 
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]




[PHP] php search xml-file

2001-04-09 Thread Jan Grafström

Hi!
I have this xml:
list
varacar/vara
bskrford/bskr
price3600/price
nr/nr
/list
-
and this php:
$filename = "list.xml";
$fp = fopen($filename, "r");
$string = fread($fp, filesize($filename));
$string = strip_tags($string);
$refined_string = explode(" ", $string);
if (in_array($needle." ", $refined_string)) {
print "found";
} else {
print "notfound";
}
fclose ($fp);
---
I always get notfound when I set $needle to a word inside the xml-file.
My script doesnt work.
Is it possible also to write a script wich can find the word "ford" if
You only ask for "for"?
I have just started to learn about php search and I am very thankful for
any help.

Regards
Jan


-- 
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]




Re: [PHP] php search xml-file

2001-04-09 Thread elias

try learning about: XML parser functions

-elias
http://www.kameelah.org/eassoft

"Jan Grafström" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi!
 I have this xml:
 list
 varacar/vara
 bskrford/bskr
 price3600/price
 nr/nr
 /list
 -
 and this php:
 $filename = "list.xml";
 $fp = fopen($filename, "r");
 $string = fread($fp, filesize($filename));
 $string = strip_tags($string);
 $refined_string = explode(" ", $string);
 if (in_array($needle." ", $refined_string)) {
 print "found";
 } else {
 print "notfound";
 }
 fclose ($fp);
 ---
 I always get notfound when I set $needle to a word inside the xml-file.
 My script doesn´t work.
 Is it possible also to write a script wich can find the word "ford" if
 You only ask for "for"?
 I have just started to learn about php search and I am very thankful for
 any help.

 Regards
 Jan


 --
 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]




-- 
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]




[PHP] php and xml

2001-02-13 Thread Jan Grafström

Hi!
I have this php:
$message = ereg_replace("\r","", $message);
$message =
"med$message/mednam$name/namadr$adress/adrtel$tele/tel";
$fp = fopen (basename($PHP_SELF) . ".comment", "a");
fwrite ($fp, $message);
fclose ($fp);
There must be something wrong in first line beacause the value of message is
not writed.
I also want the output to contain a customer nr ?in beginning.

Thanks for any help
Jan Grafstrom



-- 
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]




Re: [PHP] php and xml

2001-02-13 Thread Nathan Cassano

Steve,
Did you take a look at the raw data returned by the fsockopen file pointer.
There may be some http headers that are tripping up the xml parser.

-Original Message-
From: Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 12:07 PM
To: PHP Mailing Listl (E-mail)
Subject: [PHP] XML Parsing through Proxy


Hi Anybody got an idea?

I am sitting behind a proxy and I want to able to parse an XML.
So I have to use fsockopen() to get through my firewall and get the page.
So far, everything goes wel, but I am not able to parse the file, because I
think it is not in XML format if I use "GET http:// "
Does anyone has an idea how I can solve this?

My code so far (bits and pieces of anywhere :) )


Steve


?php

#
#       Parse XML through Proxy   #
#

// Define Variables

# Proxy Settings
$proxy_ip="proxy.server.be";
$proxy_port=8080;

# XML Mapping
$map_array = array(
"NASDAQAMEX-DOT-COM" = "HEADER_TAG",
"ISSUE-NAME" = "STOCK_NAME",
"LAST-SALE-PRICE" = "LAST_SALE",
"PREVIOUS-CLOSE-PRICE" = "PREVIOUS_SALE",
"NET-CHANGE-PRICE" = "CHANGE",
"NET-CHANGE-PCT" = "CHANGE_PCT",
"TODAYS-HIGH-PRICE" = "TODAYS_HIGH",
"TODAYS-LOW-PRICE" = "TODAYS_LOW",
);

# XML File to Parse
$xmlFile_Location="http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksy
mbol=NETA";


// Functions

# StartElement Of Parser
function startElement($parser, $name, $attrs=''){
global $map_array, $temp, $current_tag;

$current_tag = $name;
if ($format = $map_array[$name]){
switch($name){
case 'NASDAQAMEX-DOT-COM':
//echo $HTTP_GET_VARS['ticker'];
break;
default:
break;
}
}
}

# EndElement Of Parser
function endElement($parser, $name, $attrs=''){
global $map_array, $temp, $current_tag;

if ($format = $map_array[$name]){
switch($name){
case 'NASDAQAMEX-DOT-COM':
return_page($temp);
$temp = '';
break;
default:
break;
}
}
}

# Process the Data between XML-Tags
function characterData($parser, $data){
global $current_tag, $temp, $catID;

switch($current_tag){
case 'ISSUE-NAME':
$temp['STOCK_NAME'] = $data;
$current_tag = '';
break;
case 'LAST-SALE-PRICE':
$temp['LAST_SALE'] = $data;
$current_tag = '';
break;
default:
break;
}
}

# Create the XML Parser and set options
$type="UTF-8";
$xml_parser = xml_parser_create($type);
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, 'startElement','endElement');
xml_set_character_data_handler($xml_parser, 'characterData');

/* Open a connection through Proxy with Nasdaq and start parsing */
$sockPointer = fsockopen($proxy_ip,$proxy_port, $errNo, $errStr,30);
//Connect to Proxy

if( !$sockPointer ){
echo "$errStr Proxy not Available \n\n";
exit();
}
else{
fputs($sockPointer,"GET $xmlFile_Location/ ?xml version=\"1.0\"
?\n\n");
while (!feof($sockPointer)){
$Data = fgets($sockPointer, 10);
$tag= "?xml version=\"1.0\" ?\n\n";
if( eregi("xml version",$Data) ){
$Parse=1;
}
if($Parse==1){
if (!($Data = utf8_encode($Data))){
echo 'ERROR'."\n";
}
if (!xml_parse($xml_parser, $Data, feof($sockPointer))){
die(sprintf( "XML error: %s at line %d\n\n",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
}
fclose($sockPointer);
}

xml_parser_free($xml_parser);

?


-- 
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]




Re: [PHP] php and xml

2001-02-13 Thread Chris Lee

?php

fwrite(fopen("$PHP_SELF.xml", 'w'), "messagetesting
testing/message");
?

works for me on my linux box. have you checked your permisions ?


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



""Jan Grafström"" [EMAIL PROTECTED] wrote in message
96c6t7$52l$[EMAIL PROTECTED]">news:96c6t7$52l$[EMAIL PROTECTED]...
 Hi!
 I have this php:
 $message = ereg_replace("\r","", $message);
 $message =
 "med$message/mednam$name/namadr$adress/adrtel$tele/tel";
 $fp = fopen (basename($PHP_SELF) . ".comment", "a");
 fwrite ($fp, $message);
 fclose ($fp);
 There must be something wrong in first line beacause the value of message
is
 not writed.
 I also want the output to contain a customer nr ?in beginning.

 Thanks for any help
 Jan Grafstrom



 --
 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]




-- 
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]