Re: [PHP] SimpleXMLElement is not Simple
On Friday 28 September 2007 11:21, Jeffery Fernandez wrote: > On Friday 28 September 2007 11:09, Nathan Nobbe wrote: > > just curious, what database are you using? > > I am using MySQL Ver 14.12 Distrib 5.0.22 Any clues Nathan? I have done some further testing and found that if I copy the working code (standalone script) and put it amongst the application code, that doesn't work either. I am thinking its a locale or character encoding problem. Any thoughts ? cheers, Jeffery > > cheers, > Jeffery > > > -nathan > > > > On 9/27/07, Jeffery Fernandez <[EMAIL PROTECTED]> wrote: > > > I am having nightmares with this bit off code. > > > > > > The following code work perfectly fine: > > > > > > $soap_request_string = << > > > > > http://www.w3.org/2003/05/soap-envelope"; > > > xmlns:ns1="urn:Gateway_Proxy" > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > > > http://www.w3.org/2003/05/soap-encoding";> > > > > > > http://www.w3.org/2003/05/soap-encoding";> > > > 61ecc268-1cd0-f468 > > > 15495 > > > > > > > > > &payment_id=61ecc268-1cd0-f468 > >ry _string> Order from Student Library Fees with > > > Payment Id: 61ecc268-1cd0-f468 > > > > > > > > > > > > XML; > > > > > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > > > http://www.w3.org/2003/05/soap-envelope'); > > > print_r($xml); > > > $ns = $xml->getNamespaces(true); > > > //print_r($ns); > > > > > > foreach ($xml->children($ns['env']) as $body) > > > { > > > //printf("%s", $body->getName()); > > > > > > foreach ($body->children($ns['ns1']) as $function) > > > { > > > printf("function %s()", $function->getName()); > > > > > > foreach ($function->children() as $parameters) > > > { > > > printf("%s => \"%s\"", > > > $parameters->getName(), $parameters); > > > } > > > } > > > } > > > > > > > > > However when the XML string is coming from the database it does not > > > work. The Field and table have a collation of "utf8_unicode_ci" > > > > > > $soap_request_string = trim(str_replace(array("\n"), '', > > > $record['SoapRequestEnvelope'])); > > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > > > http://www.w3.org/2003/05/soap-envelope'); > > > print_r($xml); > > > > > > > > > The above code is supposed to print out the following (for me to > > > proceed further): > > > > > > SimpleXMLElement Object > > > ( > > > [Body] => SimpleXMLElement Object > > > ( > > > ) > > > ) > > > > > > > > > but only returns: > > > SimpleXMLElement Object > > > ( > > > ) > > > > > > > > > The XL string from the database looks exactly like this (after > > > replacing new lines): > > > > > > http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi=" > > > http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > > > http://www.w3.org/2003/05/soap-encoding";> > >en t > > > env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";> > >>5 > > > ce30dcc-7df7-04e810 > >ack > > > _query_string>&payment_id=5ce30dcc-7df7-04e8 > >>Order from Student Library Fees with Payment Id: > > > 5ce30dcc-7df7-04e8 > >y> > > > > > > > > > I can't figure out whats wrong with the code. Any suggestions? > > > > > > cheers, > > > Jeffery > > > -- > > > Internet Vision Technologies > > > Level 1, 520 Dorset Road > > > Croydon > > > Victoria - 3136 > > > Australia -- Internet Vision Technologies Level 1, 520 Dorset Road Croydon Victoria - 3136 Australia pgpd4X4Xvas84.pgp Description: PGP signature
Re: [PHP] SimpleXMLElement is not Simple
On Friday 28 September 2007 11:09, Nathan Nobbe wrote: > just curious, what database are you using? I am using MySQL Ver 14.12 Distrib 5.0.22 cheers, Jeffery > > -nathan > > On 9/27/07, Jeffery Fernandez <[EMAIL PROTECTED]> wrote: > > I am having nightmares with this bit off code. > > > > The following code work perfectly fine: > > > > $soap_request_string = << > > > http://www.w3.org/2003/05/soap-envelope"; > > xmlns:ns1="urn:Gateway_Proxy" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > > http://www.w3.org/2003/05/soap-encoding";> > > > > http://www.w3.org/2003/05/soap-encoding";> > > 61ecc268-1cd0-f468 > > 15495 > > > > > > &payment_id=61ecc268-1cd0-f468 >_string> Order from Student Library Fees with Payment > > Id: 61ecc268-1cd0-f468 > > > > > > > > XML; > > > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > > http://www.w3.org/2003/05/soap-envelope'); > > print_r($xml); > > $ns = $xml->getNamespaces(true); > > //print_r($ns); > > > > foreach ($xml->children($ns['env']) as $body) > > { > > //printf("%s", $body->getName()); > > > > foreach ($body->children($ns['ns1']) as $function) > > { > > printf("function %s()", $function->getName()); > > > > foreach ($function->children() as $parameters) > > { > > printf("%s => \"%s\"", $parameters->getName(), > > $parameters); > > } > > } > > } > > > > > > However when the XML string is coming from the database it does not work. > > The Field and table have a collation of "utf8_unicode_ci" > > > > $soap_request_string = trim(str_replace(array("\n"), '', > > $record['SoapRequestEnvelope'])); > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > > http://www.w3.org/2003/05/soap-envelope'); > > print_r($xml); > > > > > > The above code is supposed to print out the following (for me to proceed > > further): > > > > SimpleXMLElement Object > > ( > > [Body] => SimpleXMLElement Object > > ( > > ) > > ) > > > > > > but only returns: > > SimpleXMLElement Object > > ( > > ) > > > > > > The XL string from the database looks exactly like this (after replacing > > new lines): > > > > http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi=" > > http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > > http://www.w3.org/2003/05/soap-encoding";> >t > > env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>5 > >ce30dcc-7df7-04e810 >_query_string>&payment_id=5ce30dcc-7df7-04e8 >ransaction_note>Order from Student Library Fees with Payment Id: > > 5ce30dcc-7df7-04e8 > > > > > > > > I can't figure out whats wrong with the code. Any suggestions? > > > > cheers, > > Jeffery > > -- > > Internet Vision Technologies > > Level 1, 520 Dorset Road > > Croydon > > Victoria - 3136 > > Australia -- Internet Vision Technologies Level 1, 520 Dorset Road Croydon Victoria - 3136 Australia pgpYLgM4DjM0T.pgp Description: PGP signature
Re: [PHP] SimpleXMLElement is not Simple
just curious, what database are you using? -nathan On 9/27/07, Jeffery Fernandez <[EMAIL PROTECTED]> wrote: > > I am having nightmares with this bit off code. > > The following code work perfectly fine: > > $soap_request_string = << > http://www.w3.org/2003/05/soap-envelope"; > xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > http://www.w3.org/2003/05/soap-encoding";> > > http://www.w3.org/2003/05/soap-encoding";> > 61ecc268-1cd0-f468 > 15495 > > > &payment_id=61ecc268-1cd0-f468 > Order from Student Library Fees with Payment Id: > 61ecc268-1cd0-f468 > > > > XML; > > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > http://www.w3.org/2003/05/soap-envelope'); > print_r($xml); > $ns = $xml->getNamespaces(true); > //print_r($ns); > > foreach ($xml->children($ns['env']) as $body) > { > //printf("%s", $body->getName()); > > foreach ($body->children($ns['ns1']) as $function) > { > printf("function %s()", $function->getName()); > > foreach ($function->children() as $parameters) > { > printf("%s => \"%s\"", $parameters->getName(), > $parameters); > } > } > } > > > However when the XML string is coming from the database it does not work. > The Field and table have a collation of "utf8_unicode_ci" > > $soap_request_string = trim(str_replace(array("\n"), '', > $record['SoapRequestEnvelope'])); > $xml = new SimpleXMLElement($soap_request_string, NULL, false, ' > http://www.w3.org/2003/05/soap-envelope'); > print_r($xml); > > > The above code is supposed to print out the following (for me to proceed > further): > > SimpleXMLElement Object > ( > [Body] => SimpleXMLElement Object > ( > ) > ) > > > but only returns: > SimpleXMLElement Object > ( > ) > > > The XL string from the database looks exactly like this (after replacing > new lines): > > http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc=" > http://www.w3.org/2003/05/soap-encoding";> env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>5ce30dcc-7df7-04e810&payment_id=5ce30dcc-7df7-04e8Order > from Student Library Fees with Payment Id: > 5ce30dcc-7df7-04e8 > > > I can't figure out whats wrong with the code. Any suggestions? > > cheers, > Jeffery > -- > Internet Vision Technologies > Level 1, 520 Dorset Road > Croydon > Victoria - 3136 > Australia > >
[PHP] SimpleXMLElement is not Simple
I am having nightmares with this bit off code. The following code work perfectly fine: $soap_request_string = << http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="http://www.w3.org/2003/05/soap-encoding";> http://www.w3.org/2003/05/soap-encoding";> 61ecc268-1cd0-f468 15495 &payment_id=61ecc268-1cd0-f468 Order from Student Library Fees with Payment Id: 61ecc268-1cd0-f468 XML; $xml = new SimpleXMLElement($soap_request_string, NULL, false, 'http://www.w3.org/2003/05/soap-envelope'); print_r($xml); $ns = $xml->getNamespaces(true); //print_r($ns); foreach ($xml->children($ns['env']) as $body) { //printf("%s", $body->getName()); foreach ($body->children($ns['ns1']) as $function) { printf("function %s()", $function->getName()); foreach ($function->children() as $parameters) { printf("%s => \"%s\"", $parameters->getName(), $parameters); } } } However when the XML string is coming from the database it does not work. The Field and table have a collation of "utf8_unicode_ci" $soap_request_string = trim(str_replace(array("\n"), '', $record['SoapRequestEnvelope'])); $xml = new SimpleXMLElement($soap_request_string, NULL, false, 'http://www.w3.org/2003/05/soap-envelope'); print_r($xml); The above code is supposed to print out the following (for me to proceed further): SimpleXMLElement Object ( [Body] => SimpleXMLElement Object ( ) ) but only returns: SimpleXMLElement Object ( ) The XL string from the database looks exactly like this (after replacing new lines): http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>http://www.w3.org/2003/05/soap-encoding";>5ce30dcc-7df7-04e810&payment_id=5ce30dcc-7df7-04e8Order from Student Library Fees with Payment Id: 5ce30dcc-7df7-04e8 I can't figure out whats wrong with the code. Any suggestions? cheers, Jeffery -- Internet Vision Technologies Level 1, 520 Dorset Road Croydon Victoria - 3136 Australia pgpSwDIXaIYCH.pgp Description: PGP signature