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

[PHP] SimpleXML and the Single String (SOLVED)

2012-02-20 Thread Jay Blanchard
Howdy, My PHP chops are a little rough around the edges so I know that I am missing something. I am working with SimpleXML to retrieve values from an XML file like this - $xmlCompany = $xml->SignonRq->SignonTransport->CustId->SPName; If I echo $xmlCompany I get the proper information. If I u

[PHP] SimpleXML - parsing attributes with a namespace

2011-06-03 Thread Anthony Gladdish
Hi, Using following code does not parse the "xml:id" attribute. If I change the attribute's namespace to anything other than "xml" ( e.g. "new:id" ) then it works. $string = << XML; $xml = simplexml_load_string($string); foreach($xml->teiHeader->profileDesc->particDesc->person[

[PHP] SimpleXML - parsing attributes with a namespace

2011-06-03 Thread Anthony Gladdish
Hi, Using following code does not parse the "xml:id" attribute. If I change the attribute's namespace to anything other than "xml" ( e.g. "new:id" ) then it works. $string = << XML; $xml = simplexml_load_string($string); foreach($xml->teiHeader->profileDesc->particDesc->person[

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

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

2010-09-28 Thread Brian Dunning
I am kind of jacked here. I have a SimpleXML object that's been converted to an array. In one of the nodes, for no reason I can see, the array is populated differently if there is only one than if there are multiple s. If there is just one, my $order_item array looks like this: Array ( [or

[PHP] simpleXML - can't add children - why? - stuck

2010-08-04 Thread MEM
Hello all, I'm struggling here, but no joy so far. Having this XML file that I'm loading using simplexml_load_file(): http://pastebin.com/JiW3LxWM I need to add some children nodes after line 8. What do I need to add? This: http://pastebin.com/mT27g3ZN In order to do so, I have used the follo

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 -

[PHP] simplexml choking on apparently valid XML

2010-05-06 Thread Brian Dunning
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 - Jeff's It's returning "Premature end of data in tag client_or

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

[PHP] SimpleXML: convert xml to text

2010-03-14 Thread Dasn
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 right" while all the central stuff was lost. How should I print it as "left center1 ok center2 right" ? Tha

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

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

2010-02-06 Thread TerryA
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 these elements but only need d

[PHP] SimpleXML or DOMDocument help

2009-12-09 Thread Michael Alaimo
Hello All, I have an XML document that has elements as such: Test/Query:Equal> I cannot figure out how to access these with simple xml. I am not opposed to a DOMDocument solution either. Would anyone know what to do in this case? I think the

[PHP] SimpleXML var_dump() weirdness

2009-10-13 Thread Mattias Thorslund
Hi, It seems that var_dump() of a SimpleXMLElement does not show an attribute of elements that contain text content? I hope my examples might show what I mean: $xml = ''; $simple = new SimpleXMLElement($xml); var_dump($simple); echo $simple->asXML(); This results in: object(SimpleXMLElement

[PHP] SimpleXML Class

2009-05-06 Thread Cesco
Could you help me clarify one thing that I don't understand... let's put it simple, just imagine that I have a tiny XML document with a list of movies: Gone with the wind I want to read this XML file and write the name of the first (and only) movie in th

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

[PHP] SimpleXML output encoding

2009-05-05 Thread Ondrej Kulaty
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 possible? thanks. -- Ondrej Kulaty -- P

Re: [PHP] problem with PHP simplexml and doxygen generated XML

2009-04-05 Thread hessiess
> I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT > > On Sun, Apr 5, 2009 at 4:08 PM, wrote: > >> > >> > >> > On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote: >> > >> >> I have bean trying to right a PHP script to generate XHTML code from >> >> the >> >> class documentation xml files cr

Re: [PHP] problem with PHP simplexml and doxygen generated XML

2009-04-05 Thread Andrew Williams
I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT On Sun, Apr 5, 2009 at 4:08 PM, wrote: > > > > > > On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote: > > > >> I have bean trying to right a PHP script to generate XHTML code from > >> the > >> class documentation xml files created by Doxy

Re: [PHP] problem with PHP simplexml and doxygen generated XML

2009-04-05 Thread hessiess
> > > On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote: > >> I have bean trying to right a PHP script to generate XHTML code from >> the >> class documentation xml files created by Doxygen(the HTML it outputs >> is >> invalid, messy and virtually imposable to integrate into another web >> page

Re: [PHP] problem with PHP simplexml and doxygen generated XML

2009-04-03 Thread Phpster
On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote: I have bean trying to right a PHP script to generate XHTML code from the class documentation xml files created by Doxygen(the HTML it outputs is invalid, messy and virtually imposable to integrate into another web page). One thing has

[PHP] problem with PHP simplexml and doxygen generated XML

2009-04-03 Thread hessiess
I have bean trying to right a PHP script to generate XHTML code from the class documentation xml files created by Doxygen(the HTML it outputs is invalid, messy and virtually imposable to integrate into another web page). One thing has bean causing problems, the tags which start with `@', for exampl

[PHP] SimpleXML

2009-02-24 Thread Alex Chamberlain
Hi, I am trying to write a PHP interface to ISBNdb.com. When I make a certain request, the following is returned Language, Proof and Logic Jon Barwise, John Etchemendy, Center for the Study of Language and Inf Amazon.com -- Nonfiction -- Philosophy -- Logic & Language

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

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

2008-12-18 Thread Dan Joseph
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 ( [PackageID] => 804 [PackageName] => Silver [BandwidthGB] => 20 [WebSto

[PHP] Simplexml encodes output xml

2008-11-05 Thread Manoj Singh
Hi All, I am using PHP's senderxml library to generate the xml. My problem is that xml generated by this library encode some characters like >, & etc. Since i have to give the output xml to the device so i don't want to encode these characters. I know there is html_entity_decode method which can d

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

[PHP] SimpleXML strange behaviour.

2008-09-09 Thread Mirco Soderi
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']); break; } } but the following does not

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

[PHP] simplexml

2008-07-10 Thread Joakim Ling
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. '); $root = $xml->addChild('tests'); $root->addChild('test', 'test & test'); echo $xml->asXML(); ?> // cheers jo

[PHP] SimpleXML and registerXPathNamespace

2008-06-13 Thread Mario Caprino
Hi, I am having problems with the below test case. I am using an extended googlebase Atom format to store my data. Included in the test case is a simplified version of my XML-document. PROBLEM: Why do I need to re-register namespace 'a' when using xpath through the result of a previous xpath()-s

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://

[PHP] SimpleXML Bug question

2008-01-14 Thread Naz Gassiep
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 developer/s who intend it to be that way are wrong. Under no c

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 >

[PHP] SimpleXML addChild() namespace problem

2008-01-14 Thread Carole E. Mah
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 When really all we want is this: Musical Mockery Furthermore, dumping it into a

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' ); > $

[PHP] simplexml problem

2007-12-31 Thread Dani Castaños
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' ); $ticketType = $file->ticketType; What i really have into $ticketType is a SimpleXMLElement... not t

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

[PHP] SimpleXML error

2007-11-26 Thread Skip Evans
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 following: Document DTD 20031113//EN" "galeeBkdoc.dtd"> 214-215 Thomas Jefferson and the Revision of the Virginia Laws I am then attempting to extract the t

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

2007-04-10 Thread Don Don
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 and >produces an error at the end of the foreach loop when it reaches the end of >the tag, it tries to look fo

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 fi

[PHP] SimpleXML end of element/tag error

2007-04-05 Thread Don Don
I am using simple xml to parse an xml file, the program parses the file and produces an error at the end of the foreach loop when it reaches the end of the tag, it tries to look for an element/tag when there is none and produces an error "Call to a member function attributes() on a non-object" t

[PHP] SimpleXML & libxml options (XInclude)

2007-02-28 Thread Ben Roberts
Hi there. I'm hoping someone can help me with what I think might be a slightly obscure problem. I'm trying to get the SimpleXML extension to read an XML file and process the XInclude statements within the XML file. The SimpleXML docs state that libxml options may be specified using the pre

[PHP] SimpleXML is creating nodes when it shouldn't...

2006-05-11 Thread D. Dante Lorenso
I've recently upgraded to PHP 5.1.4 from 5.1.2 and noticed that in 5.1.3 there were changes made to SimpleXML. Now, when I touch an element which didn't used to exist, instead of acting like it didn't exist, it creates it! That's horrible! Well, this used to work: 1"; $xml = simplexml_load_

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

[PHP] simplexml and serialize error

2006-04-29 Thread Anthony Ettinger
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 output locally. When I read it back in and run unserialize() to do a

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

  1   2   >