Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-22 Thread Jay Blanchard
>> I don't really see a need to add an extra layer or class extension >> when casting works fine. Am I wrong? Why add several lines of code in >> an extension class? >> > To keep the code readable? > > $value = $xml->node; > > vs. > > $value = (String)$xml->node; > > I like the first one. Plus

Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-22 Thread Marco Behnke
Am 22.02.12 16:04, schrieb Jay Blanchard: > On 2/22/2012 8:32 AM, ma...@behnke.biz wrote: >> There is another nice way. >> You can pass a second value to the simple xml constructor which is a >> class >> name to be used instead of SimpleXMLElement. >> You can write your own class that extends Sim

Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-22 Thread Jay Blanchard
On 2/22/2012 8:32 AM, ma...@behnke.biz wrote: There is another nice way. You can pass a second value to the simple xml constructor which is a class name to be used instead of SimpleXMLElement. You can write your own class that extends SimpleXMLElement and override the magic methods to skip the

Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-22 Thread ma...@behnke.biz
There is another nice way. You can pass a second value to the simple xml constructor which is a class name to be used instead of SimpleXMLElement. You can write your own class that extends SimpleXMLElement and override the magic methods to skip the casting Simon Schick hat am 22. Februar 2012 u

Re: [PHP] SimpleXML and the Single String (SOLVED)

2012-02-21 Thread Simon Schick
Hi, Jay If you're not using the variable *$xmlCompany* somewhere else I'd try to skip the array and just do it with this single line: *$arrayLead[0]->Company = (string) $xml->SignonRq->SignonTransport->CustId->SPName;* The result should not differ from what you have now. Bye Simon 2012/2/21 Jay

Re: [PHP] SimpleXML/array duality (like particles & waves)

2010-09-28 Thread Nathan Nobbe
On Tue, Sep 28, 2010 at 5:06 PM, Brian Dunning wrote: > If you read down to the bottom of the post, the function I used is given. My apologies for the hasty response. well, if i had to guess, id say thats where the problem is. why cant you just iterate over the object w/ the built in functiona

Re: [PHP] SimpleXML/array duality (like particles & waves)

2010-09-28 Thread Brian Dunning
If you read down to the bottom of the post, the function I used is given. On Sep 28, 2010, at 3:47 PM, Nathan Nobbe wrote: > On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning wrote: > I am kind of jacked here. I have a SimpleXML object that's been converted to > an array. > > how was the SimpleX

Re: [PHP] SimpleXML/array duality (like particles & waves)

2010-09-28 Thread Nathan Nobbe
On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning wrote: > I am kind of jacked here. I have a SimpleXML object that's been converted > to an array. how was the SimpleXMLElement converted to an array? -nathan

Re: [PHP] simplexml choking on apparently valid XML - Solved

2010-05-10 Thread Brian Dunning
I was able to resolve this by changing the XML file encoding from UTF-8 to ISO-8859-1. Works like a charm now, with the XML-encoded characters. Thanks to all who offered their help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] simplexml choking on apparently valid XML

2010-05-08 Thread Peter Lind
On 8 May 2010 00:39, Nathan Nobbe wrote: > > hmm, both the strings seem to work fine on my laptop: > +1. Have no problem with either string -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchs

Re: [PHP] simplexml choking on apparently valid XML

2010-05-08 Thread Deva
& - & amp; added space because browser is converting it to & :) On 5/8/10, Deva wrote: > I think that "&" should be & because you cant use "&" in xml as > independent alphbet > > On 5/7/10, Dan Joseph wrote: >> On Thu, May 6, 2010 at 8:02 PM, Brian Dunning >> wrote: >> >>> Hey all - >>> >>> I'm

Re: [PHP] simplexml choking on apparently valid XML

2010-05-08 Thread Deva
I think that "&" should be & because you cant use "&" in xml as independent alphbet On 5/7/10, Dan Joseph wrote: > On Thu, May 6, 2010 at 8:02 PM, Brian Dunning wrote: > >> Hey all - >> >> I'm using simplexml-load-string just to validation a string of XML, and >> libxml-get-errors to return any e

Re: [PHP] simplexml choking on apparently valid XML

2010-05-07 Thread Nathan Nobbe
On Fri, May 7, 2010 at 4:32 PM, Brian Dunning wrote: > This time simplexml-load-string also gave me the same error on the > following line: > > Charlie & Brady > > Can anyone confirm whether simplexml-load-string will or will not accept or > allow XML-encoded characters? It seems that it should an

Re: [PHP] simplexml choking on apparently valid XML

2010-05-07 Thread Brian Dunning
This time simplexml-load-string also gave me the same error on the following line: Charlie & Brady Can anyone confirm whether simplexml-load-string will or will not accept or allow XML-encoded characters? It seems that it should and would be pretty surprising if it wouldn't. On May 6, 2010,

Re: [PHP] simplexml choking on apparently valid XML

2010-05-06 Thread Dan Joseph
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning wrote: > Hey all - > > I'm using simplexml-load-string just to validation a string of XML, and > libxml-get-errors to return any errors. It's always worked before, but today > it's choking on this line in the XML: > > Basketball Personalized Notebook -

Re: [PHP] SimpleXML: convert xml to text

2010-03-14 Thread Dasn
On Sun, 14 Mar 2010 22:02:22 +0800, Ashley Sheridan wrote: On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote: Hello, I want to convert some xml stuff to simple string using php, say: left center1okcenter2right XML; $xml = simplexml_load_string($string); echo $xml; ?> The code will output "left

Re: [PHP] SimpleXML: convert xml to text

2010-03-14 Thread Dasn
On Sun, 14 Mar 2010 22:02:22 +0800, Ashley Sheridan wrote: On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote: Hello, I want to convert some xml stuff to simple string using php, say: left center1okcenter2right XML; $xml = simplexml_load_string($string); echo $xml; ?> The code will output "left

Re: [PHP] SimpleXML: convert xml to text

2010-03-14 Thread Ashley Sheridan
On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote: > Hello, I want to convert some xml stuff to simple string using php, say: > > > $string = << left center1okcenter2right > XML; > > $xml = simplexml_load_string($string); > echo $xml; > ?> > The code will output "left right" while all the centra

Re: [PHP] simplexml - can it do what I need?

2010-02-08 Thread TerryA
Got it! I corrected my syntax and this code now works as far as I can tell: xpath('//lot') as $lot) { echo $lot->numero_lot, 'type ', $lot->type, $lot->identification, ''; echo 'Prix maxi: ', $lot->tarif_max, ' Prix mini: ', $lot->tarif_min, ''; foreach( $lot->elements->element as

Re: [PHP] simplexml - can it do what I need?

2010-02-08 Thread TerryA
Hi Guys Thanks for all your input. This forum is great! I can get the attributes OK but I can't code the checking routing correctly. This is what I have: Many thanks again for your input. I tried this but it only gives me the data for each element. I need to be able to access the attributes of t

Re: [PHP] simplexml - can it do what I need?

2010-02-08 Thread Ashley Sheridan
On Sun, 2010-02-07 at 23:24 -0800, TerryA wrote: > Hi Carlos > > I looked at the documentation for hours but don't see any solution. I'm > uploading a sample file here. The full file contains around 100 properties > but the uploaded file has just one. I need to extract data from this file to > wr

Re: [PHP] simplexml - can it do what I need?

2010-02-07 Thread TerryA
Hi Carlos I looked at the documentation for hours but don't see any solution. I'm uploading a sample file here. The full file contains around 100 properties but the uploaded file has just one. I need to extract data from this file to write to a MySQL database. I have no problem in doing this unti

Re: [PHP] simplexml - can it do what I need?

2010-02-07 Thread Carlos Medina
TerryA schrieb: Hi Shawn Thanks for answering my query. I have looked at the suggestions: $xml = simplexml_load_file('file.xml', 'SimpleXMLElement', LIBXML_NOCDATA); I am/was able to load the file OK and to access the data by iteration. However, I can't find a way to extract data by attributes.

Re: [PHP] simplexml - can it do what I need?

2010-02-07 Thread TerryA
Hi Shawn Thanks for answering my query. I have looked at the suggestions: $xml = simplexml_load_file('file.xml', 'SimpleXMLElement', LIBXML_NOCDATA); I am/was able to load the file OK and to access the data by iteration. However, I can't find a way to extract data by attributes. I need something

Re: [PHP] simplexml - can it do what I need?

2010-02-06 Thread Shawn McKenzie
TerryA wrote: > My first post and I'm just a few days into learning PHP so that I can extract > data from an XML feed for updating a MySQL driven website. Simplexml grabs > most of my data without a problem but I can't get at the data in elements > such as: > > > > > I have around a hundred of

Re: [PHP] SimpleXML output encoding

2009-05-05 Thread Ondrej Kulaty
Because i am working on an old system which is in ISO, i cant use unicode. -- Ondrej Kulaty "tedd" píse v diskusním príspevku news:p06240802c625f6b4e...@[192.168.1.101]... > At 2:40 PM +0200 5/5/09, Ondrej Kulaty wrote: >>Hi, >>is there any way how to set output encoding for SimpleXML? >>It wil

Re: [PHP] SimpleXML output encoding

2009-05-05 Thread tedd
At 2:40 PM +0200 5/5/09, Ondrej Kulaty wrote: Hi, is there any way how to set output encoding for SimpleXML? It will load XML document in any encoding, but internally, it converts the document to UTF-8 and outputs it in this encoding. I would like to have output encoding set to ISO-8859-2, is it

Re: [PHP] SimpleXML - issue with getting data out of the object returned

2008-12-18 Thread Dan Joseph
On Thu, Dec 18, 2008 at 10:01 PM, German Geek wrote: > $val = (string) $x->Package->PackageID; > or > $val = (int) $x->Package->PackageID; > > Ha... I would have never figured that out... Thank you to you both! That did the trick. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/mon

Re: [PHP] SimpleXML - issue with getting data out of the object returned

2008-12-18 Thread German Geek
Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Dec 19, 2008 at 3:50 PM, Dan Joseph wrote: > Hi, > > I have a basic XML document that I am grabbing with > simplexml_load_string(), > here is the print_r: > > SimpleXMLElement Object > ( >[Package] => SimpleXMLElement Object >( >

Re: [PHP] SimpleXML strange behaviour.

2008-09-09 Thread Nathan Nobbe
2008/9/9 Mirco Soderi <[EMAIL PROTECTED]> > Do you know any reason why the following code does work > > > $xmlOperazioni = simplexml_load_file($xmlFilename); > foreach($xmlOperazioni->operazione as $operazione) { > if($operazione['nome'] == $operazioneRichiesta) { > require($operazione['php

Re: [PHP] simplexml

2008-07-10 Thread Nathan Nobbe
On Thu, Jul 10, 2008 at 10:55 AM, Nate Tallman < [EMAIL PROTECTED]> wrote: > You have to handle the html special chars. > > & == & and if you use the SimpleXMLElement constructor, it will throw an exception, rather than just return false, which is useful, because it tells you what went wrong. -

Re: [PHP] simplexml

2008-07-10 Thread Nate Tallman
You have to handle the html special chars. & == & On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling <[EMAIL PROTECTED]> wrote: > Hi > > > > I'm using simplexml to create some xml files. > > Here's a stripped example, how can I get this to work? Tried millions > different ways still no joy. > > > >

Re: [PHP] simplexml

2008-07-10 Thread Nate Tallman
You have to handle the html special chars. & == & On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling <[EMAIL PROTECTED]> wrote: > Hi > > > > I'm using simplexml to create some xml files. > > Here's a stripped example, how can I get this to work? Tried millions > different ways still no joy. > > > >

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-18 Thread Nathan Nobbe
On Jan 18, 2008 2:48 PM, Carole E. Mah <[EMAIL PROTECTED]> wrote: > On Jan 18, 2008 12:22 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > Are you trying to read an existing document into a SimpleXMLElement, or > are > > you trying to create a SimpleXMLElement instance and generate a document > > f

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-18 Thread Carole E. Mah
On Jan 18, 2008 12:22 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > Are you trying to read an existing document into a SimpleXMLElement, or are > you trying to create a SimpleXMLElement instance and generate a document > from that? > My impression was you were trying to do the later; please clarify

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-18 Thread Nathan Nobbe
On Jan 18, 2008 12:04 PM, Carole E. Mah <[EMAIL PROTECTED]> wrote: > I did exactly this, and still got: > > > http://www.itunes.com/dtds/podcast-1.0.dtd"; version=" > 2.0"> > > > >My Title >My Link >

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-18 Thread Carole E. Mah
>based upon information from bug #43221, if you define the namespace >beforehand >it will work. > >$xml = new SimpleXMLElement('http://apple.com"/>'); >$n = $xml->addChild("subtitle", "Musical Mockery", "http://apple.com";); >print_r($xml->asXml()); >?> > >produces: > >http://apple.com";>Musical >M

Re: [PHP] SimpleXML Bug question

2008-01-15 Thread Richard Lynch
On Tue, January 15, 2008 12:34 am, Naz Gassiep wrote: > What's the current status on this bug: > > http://bugs.php.net/bug.php?id=39164 > > Regardless of what the PHP developers say in those comments, the > modification of data when it is read is not correct. If it is intended > behavior, then the

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-15 Thread Nathan Nobbe
On Jan 14, 2008 11:21 PM, Carole E. Mah <[EMAIL PROTECTED]> wrote: > Yes, I tried the following: > > http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php > > Same results. > based upon information from bug #43221, if you define the namespace beforehand it will work. http://

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-14 Thread Carole E. Mah
Yes, I tried the following: http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php Same results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SimpleXML addChild() namespace problem

2008-01-14 Thread Nathan Nobbe
On Jan 14, 2008 10:22 PM, Carole E. Mah <[EMAIL PROTECTED]> wrote: > This is problematic code, even though it works, because it > auto-generates an unnecessary xmlns: attribute: > > $item->addChild('itunes:subtitle', $mySubTitle,"itunes"); > > It generates the following XML: > > Musical Mockery >

Re: [PHP] simplexml problem

2007-12-31 Thread Nathan Nobbe
On Dec 31, 2007 10:09 AM, Dani Castaños <[EMAIL PROTECTED]> wrote: > Thanks! Problem fixed... But I think PHP must do the cast automatically. > I think it's a bug fixed in a further version than mine as I've read > no problem; but just fyi, its not a bug; the behavior is as expected per the manua

Re: [PHP] simplexml problem

2007-12-31 Thread Dani Castaños
Nathan Nobbe escribió: On Dec 31, 2007 7:11 AM, Dani Castaños <[EMAIL PROTECTED] > wrote: Hi all! I'm using simplexml to load an xml into an object. The XML is this: 3 agenda cticket_agenda_server 1 1 addUsersToGroup

Re: [PHP] simplexml problem

2007-12-31 Thread Nathan Nobbe
On Dec 31, 2007 7:11 AM, Dani Castaños <[EMAIL PROTECTED]> wrote: > Hi all! > > I'm using simplexml to load an xml into an object. > The XML is this: > > > 3 > agenda > cticket_agenda_server > 1 > 1 > addUsersToGroup > > > When I do this: > > $file = simplexml_load_file( 'file.xml' ); > $

Re: [PHP] SimpleXML error

2007-11-26 Thread Casey
I'm not sure, but try casting $xml->title to string, like this: $title = (string) $xml->title; On Nov 26, 2007, at 1:44 PM, Skip Evans <[EMAIL PROTECTED]> wrote: Hey all, I have some XML files I need to parse and then display (they have HTML formatting in them as well). They contain the

Re: [PHP] SimpleXML end of element/tag error

2007-04-10 Thread Don Don
the code section is displayed below $xml = simplexml_load_file($_POST['feedurl']); foreach($xml->TT as $TT) { foreach($TT->TOTS as $TOTS) { $cnt++; foreach($TT->TOTS[$cnt]->attributes() as $a => $b) // problematic line. {

Re: [PHP] SimpleXML end of element/tag error

2007-04-05 Thread JM Guillermin
And with : foreach ($xml as $cs) { . } ?? jm - Original Message - From: "Don Don" <[EMAIL PROTECTED]> To: "PHP List" Sent: Thursday, April 05, 2007 10:32 AM Subject: [PHP] SimpleXML end of element/tag error I am using simple xml to parse an xml file, the program parses the file

Re: [PHP] simplexml and serialize error

2006-04-30 Thread Jochem Maas
Richard Lynch wrote: On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote: Warning: var_dump() [function.var-dump]: Node no longer exists in Foo.php on line 78 object(SimpleXMLElement)#86 (0) { } ["title"]=> I turn an xml string into a simplexml object, and then ran serialize() on it before

Re: [PHP] simplexml and serialize error

2006-04-29 Thread Richard Lynch
On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote: > Warning: var_dump() [function.var-dump]: Node no longer exists in > Foo.php on line 78 > object(SimpleXMLElement)#86 (0) { } ["title"]=> > > I turn an xml string into a simplexml object, and then ran serialize() > on it before caching the ou

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread Rasmus Lerdorf
Richard Lynch wrote: On Mon, April 10, 2006 10:24 pm, Rasmus Lerdorf wrote: You could volunteer to help maintain the user notes. I've just spent five/ten minutes with Google and php.net trying to find the best way to volunteer to do just that... Admittedly not a LOT of effort, but... Where d

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread Richard Lynch
On Mon, April 10, 2006 10:24 pm, Rasmus Lerdorf wrote: > You could volunteer to help maintain the user notes. I've just spent five/ten minutes with Google and php.net trying to find the best way to volunteer to do just that... Admittedly not a LOT of effort, but... Where do I start? I do have o

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread Richard Lynch
On Mon, April 10, 2006 10:21 pm, Robert Cummings wrote: > On Mon, 2006-04-10 at 23:11, Richard Lynch wrote: >> On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: >> > Richard Lynch wrote: >> I've added a Note to 'fopen' so maybe others won't completely miss >> this feature and look as foolish as

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread tedd
At 10:31 AM -0700 4/11/06, Rasmus Lerdorf wrote: tedd wrote: Here is an example Wez wrote years ago: -snip code - Years ago? stream_socket_client() is php5. How long ago did php5 launch? The first beta was in June 2003. But the streams code was written well before that. -Rasmus I'm

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread Rasmus Lerdorf
tedd wrote: Here is an example Wez wrote years ago: -snip code - Years ago? stream_socket_client() is php5. How long ago did php5 launch? The first beta was in June 2003. But the streams code was written well before that. -Rasmus -- PHP General Mailing List (http://www.php.net/) To un

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-11 Thread tedd
Here is an example Wez wrote years ago: -snip code - Years ago? stream_socket_client() is php5. How long ago did php5 launch? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To uns

Re: [PHP] simpleXML - simplexml_load_file() timeout? [Resolved]

2006-04-11 Thread darren kirby
Just replying to my original post as means of a follow up. I have gone ahead and used Rasmus' code, he was correct in surmising I was only worried about an overloaded and slow responding site. It would be very atypical for the site to be down completely. While the cache code was very interestin

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Robert Cummings wrote: On Mon, 2006-04-10 at 23:24, Rasmus Lerdorf wrote: Robert Cummings wrote: On Mon, 2006-04-10 at 23:11, Richard Lynch wrote: On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: Richard Lynch wrote: It would be REALLY NIFTY if fopen and friends which understand all tho

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:24, Rasmus Lerdorf wrote: > Robert Cummings wrote: > > On Mon, 2006-04-10 at 23:11, Richard Lynch wrote: > >> On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: > >>> Richard Lynch wrote: > It would be REALLY NIFTY if fopen and friends which understand all > th

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:35, Rasmus Lerdorf wrote: > Robert Cummings wrote: > > > > > I'll keep that in mind for the future when I have more free time (2 kids > > under 3 is good for keeping me occupied beyond work atm :). > > > >> A huge percentage of them being either spam, product pitches >

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Robert Cummings wrote: On Mon, 2006-04-10 at 23:11, Richard Lynch wrote: On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: Richard Lynch wrote: It would be REALLY NIFTY if fopen and friends which understand all those protocols of HTTP FTP HTTPS and so on, allowed one to set a timeout for U

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 23:11, Richard Lynch wrote: > On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: > > Richard Lynch wrote: > >> It would be REALLY NIFTY if fopen and friends which understand all > >> those protocols of HTTP FTP HTTPS and so on, allowed one to set a > >> timeout for URLs, bu

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Richard Lynch wrote: On Mon, April 10, 2006 4:46 pm, darren kirby wrote: quoth the Robert Cummings: Why do you do this on every request? Why not have a cron job retrieve an update every 20 minutes or whatnot and stuff it into a database table for your page to access? Then if the cron fails to r

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote: > Richard Lynch wrote: >> It would be REALLY NIFTY if fopen and friends which understand all >> those protocols of HTTP FTP HTTPS and so on, allowed one to set a >> timeout for URLs, but they don't and nobody with the skills to >> change >> that

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Richard Lynch wrote: It would be REALLY NIFTY if fopen and friends which understand all those protocols of HTTP FTP HTTPS and so on, allowed one to set a timeout for URLs, but they don't and nobody with the skills to change that (not me) seems even mildly interested. :-( :-( :-( Because it is a

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Richard Lynch wrote: On Mon, April 10, 2006 6:17 pm, Rasmus Lerdorf wrote: Martin Alterisio wrote: Maybe you can read the contents of the feeds using fsockopen() and stream_set_timeout() to adjust the timeout, or stream_set_blocking() to read it asynchronously, and then load the xml with simple

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Martin Alterisio \"El Hombre Gris\"
Maybe it's too late to say this, but if your real problem is that you don't want the function reading the rss feed to block the rest of your page, you can always put the output of the reading of the feed on a separate page, and include this through an iframe. darren kirby wrote: Hello all, M

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
> When I do get something figured out I will post results here. Problem > is, with > either method I need to find a feed that is slow to test with. If I > test it > with a bunk url it will just 404 immediately right? Is there a way to > simulate a slow connection? I dunno about similating a slow c

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 20:52, darren kirby wrote: > quoth the Richard Lynch: > > Perhaps, then, you should: > > maintain a list of URLs and acceptable "age" of feed. > > Attempt to snag the new content upon visit, if the content is "old" > > Show the "old" content if the feed takes longer than X sec

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Richard Lynch: > Perhaps, then, you should: > maintain a list of URLs and acceptable "age" of feed. > Attempt to snag the new content upon visit, if the content is "old" > Show the "old" content if the feed takes longer than X seconds. I really do like this idea, as I would rather use an

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 6:17 pm, Rasmus Lerdorf wrote: > Martin Alterisio wrote: >> Maybe you can read the contents of the feeds using fsockopen() and >> stream_set_timeout() to adjust the timeout, or stream_set_blocking() >> to read it asynchronously, and then load the xml with >> simplexml_load_st

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Richard Lynch
On Mon, April 10, 2006 4:46 pm, darren kirby wrote: > quoth the Robert Cummings: >> >> Why do you do this on every request? Why not have a cron job >> retrieve an >> update every 20 minutes or whatnot and stuff it into a database >> table >> for your page to access? Then if the cron fails to retrie

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Rasmus Lerdorf
Martin Alterisio wrote: Maybe you can read the contents of the feeds using fsockopen() and stream_set_timeout() to adjust the timeout, or stream_set_blocking() to read it asynchronously, and then load the xml with simplexml_load_string(). PS: I forgot to reply to all and mention you'll have to s

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Martin Alterisio: > Maybe you can read the contents of the feeds using fsockopen() and > stream_set_timeout() to adjust the timeout, or stream_set_blocking() > to read it asynchronously, and then load the xml with > simplexml_load_string(). Hello, and thanks for the response, As Robert

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Martin Alterisio
Maybe you can read the contents of the feeds using fsockopen() and stream_set_timeout() to adjust the timeout, or stream_set_blocking() to read it asynchronously, and then load the xml with simplexml_load_string(). PS: I forgot to reply to all and mention you'll have to send the GET http command a

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Robert Cummings: > On Mon, 2006-04-10 at 17:46, darren kirby wrote: > > quoth the Robert Cummings: > > > Why do you do this on every request? Why not have a cron job retrieve > > > an update every 20 minutes or whatnot and stuff it into a database > > > table for your page to access? Then

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 17:46, darren kirby wrote: > quoth the Robert Cummings: > > > > Why do you do this on every request? Why not have a cron job retrieve an > > update every 20 minutes or whatnot and stuff it into a database table > > for your page to access? Then if the cron fails to retrieve th

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread darren kirby
quoth the Robert Cummings: > > Why do you do this on every request? Why not have a cron job retrieve an > update every 20 minutes or whatnot and stuff it into a database table > for your page to access? Then if the cron fails to retrieve the feed it > can just leave the table as is, and your visito

Re: [PHP] simpleXML - simplexml_load_file() timeout?

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 15:25, darren kirby wrote: > Hello all, > > My website uses simpleXML to print the headlines from a few different RSS > feeds. The problem is that sometimes the remote feed is unavailable if there > are problems with the remote site, and the result is that I must wait for 3

Re: [PHP] SimpleXML

2006-01-18 Thread Richard Lynch
On Wed, January 18, 2006 3:49 pm, Jay Paulson wrote: > I'm a noob when it comes to parsing an XML file. I have a really > simple > file that I'm getting back from a SOAP service that I need to parse. > I > figure SimpleXML would be great! However, I'm having problems getting > the > name attribut

Re: [PHP] SimpleXML returning Object names with hyphens

2005-12-23 Thread Charlie Davis
Sweet. Thanks! The {'..'} works perfectly. Never knew about that syntax. -Charlie Jochem Maas wrote: Charlie Davis wrote: Hey all, I've run into a snag trying to use some XML output from NOAA. what NOAA when its at home? The problem is that some of the fields it sends to me have a hyph

Re: [PHP] SimpleXML returning Object names with hyphens

2005-12-23 Thread Jochem Maas
Charlie Davis wrote: Hey all, I've run into a snag trying to use some XML output from NOAA. what NOAA when its at home? The problem is that some of the fields it sends to me have a hyphen in the name. Simple XML then creates objects with hyphens in their name. So here's the object I am ha

Re: [PHP] SimpleXML doesn't work with one single XML tag line...

2005-07-15 Thread Christian Stocker
On 7/15/05, Daevid Vincent <[EMAIL PROTECTED]> wrote: > Maybe I'm missing something about XML specifications, but this doesn't seem > right to me. > > http://www.php.net/manual/en/ref.simplexml.php > > Here is a code fragment I use: > > $xml = simplexml_load_string($returnData); > var_dump($xml)

Re: [PHP] SIMPLExml problem....

2005-06-20 Thread Jochem Maas
Cruonit wrote: I just copy/paste the error from other code, but i talked to the admin and he said I might suggest that reading the error (and maybe reseaching the meaning - if you don't understand what it means) ... read this: http://www.php.net/manual/en/ini.core.php now assuming your simpl

Re: [PHP] SIMPLExml problem....

2005-06-20 Thread Jochem Maas
Cruonit wrote: I tryed this simple PHP script that uses SimpleXML control: name; ?> and i got: Fatal error: Cannot clone object of class SimpleXMLElement due to 'zend.ze1_compatibility_mode' in /mnt/storage/users/w/i/p/wipe/formular.php on line 381 a, zend.ze1_compatibility_mode is a php.in

Re: [PHP] SIMPLExml problem....

2005-06-20 Thread Paul Waring
On Mon, Jun 20, 2005 at 10:48:41AM +0200, Cruonit wrote: > I tryed this simple PHP script that uses SimpleXML control: In future, please don't post the same thing to the list three times, there really is no point. If your post isn't showing up, at least have the patience to wait a few minutes bef

Re: [PHP] SimpleXML and xpath woes

2005-03-21 Thread Richard Lynch
On Wed, March 16, 2005 9:39 am, Simon Turvey said: > (Apologies for the larger than normal wrapping - there are some long > lines) > > I'm playing with SimpleXML for reading REST responses from Amazon Web > Services. > Having successfuly read the response to my request I'd like to perform an > xpat

Re: [PHP] SimpleXML add a node

2005-03-13 Thread Claudio
@richard > I dunno about that whole try/catch thing, but if you're not going to USE > it to catch the errors, then you might as well be old school and check the > return values of all these functions. that sounds good, but , so far I know, if the API says that a function _can_ throw an exception,

Re: [PHP] SimpleXML add a node

2005-03-12 Thread Jochem Maas
Jochem Maas wrote: Richard Lynch wrote: php.net/dom ?? Like this? --- try { $dom = new DOMDocument(); $config = $dom->appendChild($dom->importNode(dom_import_simplexml($this->configXML),true)); $config->appendChild( $dom->createElement(($mode? 'softactive':'active')) ); $this->configXML = simp

Re: [PHP] SimpleXML add a node

2005-03-12 Thread Jochem Maas
Richard Lynch wrote: php.net/dom ?? Like this? --- try { $dom = new DOMDocument(); $config = $dom->appendChild($dom->importNode(dom_import_simplexml($this->configXML),true)); $config->appendChild( $dom->createElement(($mode? 'softactive':'active')) ); $this->configXML = simplexml_import_dom($config

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Jason Barnett
Richard Lynch wrote: ... >> >>} catch(Exception $e) {} > > > I dunno about that whole try/catch thing, but if you're not going to USE > it to catch the errors, then you might as well be old school and check the > return values of all these functions. > Agreed 100%. No sense in going through the o

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Richard Lynch
>> php.net/dom > > ?? > > Like this? > > --- > > try { > > $dom = new DOMDocument(); > > $config = > $dom->appendChild($dom->importNode(dom_import_simplexml($this->configXML),true)); > > $config->appendChild( $dom->createElement(($mode? 'softactive':'active')) > ); > > $this->configXML = simplexml

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Claudio
> php.net/dom ?? Like this? --- try { $dom = new DOMDocument(); $config = $dom->appendChild($dom->importNode(dom_import_simplexml($this->configXML),true)); $config->appendChild( $dom->createElement(($mode? 'softactive':'active')) ); $this->configXML = simplexml_import_dom($config); } catc

Re: [PHP] SimpleXML add a node

2005-03-11 Thread Guillermo Rauch
php.net/dom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SimpleXML: DOM, SAX or Other?

2004-10-15 Thread Christian Stocker
Hi On 15 Oct 2004 11:51:33 -, PHPDiscuss - PHP Newsgroups and mailing lists <[EMAIL PROTECTED]> wrote: > Hi, > > Does anybody have any depthful knowledge of the SimpleXML extension in > PHP5?.. > > More accurately, do you know if the simpleXml->xpath() method uses DOM, > SAX or some other m

RE: [PHP] simplexml and xpath

2004-09-22 Thread Matthew Sims
> So I've just recently fallen in love with simplexml. But from what I've > read, is it true that xpath doesn't really work properly? > > I'm using an XML file that has a section like this: > > > Title > Link > Desc Subject > 2004-09-20T18:15:00+00:00 > > > My sample of my PHP code is: > > $libr

RE: [PHP] simplexml and xpath

2004-09-21 Thread Yoed Anis
For this simple query simple do a call to $item->date to get your time. If the query is more complex in reality, do a foreach using xpath. See the example on Xpath at www.php.net/simplexml Yoed -Original Message- From: Matthew Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 21, 2

Re: [PHP] SimpleXML

2004-08-20 Thread Daniel Schierbeck
Rick Fletcher wrote: Daniel Schierbeck wrote: I am having some problems with the XML features (I use the fancy new SimpleXML). It works like a dream when I'm retrieving information from an XML document, but when I want to insert new tags it screws up. I'm trying to create a function that saves e

Re: [PHP] SimpleXML

2004-08-20 Thread Rick Fletcher
Daniel Schierbeck wrote: I am having some problems with the XML features (I use the fancy new SimpleXML). It works like a dream when I'm retrieving information from an XML document, but when I want to insert new tags it screws up. I'm trying to create a function that saves error logs in an XML f

Re: [PHP] SimpleXML

2004-08-19 Thread John Holmes
> From: Daniel Schierbeck <[EMAIL PROTECTED]> > I am having some problems with the XML features > (I use the fancy new SimpleXML). It works like > a dream when I'm retrieving information from > an XML document, but when I want to insert new > tags it screws up. Someone will correct me if I'm

RE: [PHP] SimpleXML node detection.

2004-03-24 Thread Rick Fletcher
> My peoblem is that i have something like the following xml... > > ~ > ~foo > ~foo > ~ > ~ > Any ideas on how i can check to see it the ignore node > exists or not? You can't. This is a bug that just recently

  1   2   >