Re: [PHP] XML to Array

2013-03-12 Thread Bastien


Bastien Koert

On 2013-03-11, at 10:50 PM, Karl DeSaulniers k...@designdrumm.com wrote:

 
 On Mar 11, 2013, at 8:22 AM, Bastien Koert wrote:
 
 On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:
 
 On Mar 10, 2013, at 6:03 AM, richard gray wrote:
 
 On 10/03/2013 11:47, Karl DeSaulniers wrote:
 
 Hi Guys,
 I am hoping someone can guide me or help me fix this issue.
 I have been lost in the code for some time now.
 I am trying to get the attributes of an xml node.
 I have this code:
 [snip]
 
 this may help -
 http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing
 
 I do admit I haven't the foggiest idea what I am doing here, so I am
 noobing out here on how this php function is really working.
 I got it off php.net and am trying to implement it in my code. Without my
 addition it works well except it doesn't grab any attributes
 which I need in order for my script to work properly.
 
 Any ideas on what I am doing wrong?
 
 TIA,
 
 
 HTH
 rich
 
 
 
 Thanks rich,
 That uses simpleXML. I am using xml_parse_create.
 Any ideas for xml_parse_create? I really like the way this function
 puts everything into an array that I can traverse. I only need it to put
 the attribute values in the array for the corresponding node and I am done.
 *Sigh
 
 Thanks for your help,
 
 Best,
 
 
 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 I came across this XML to JSON to an array some time ago. It might be 
 something
 
 function xmlToArray($xml)
 {
return json_decode(json_encode((array) simplexml_load_string($xml)),1);
 }
 
 -- 
 
 Bastien
 
 Cat, the other other white meat
 
 Actually no, I don't need the root node after all.
 Looks like it finally works! :)
 
 Thank you Bastien! Nice one-liner.
 
 Best,
 
 Karl DeSaulniers
 Design Drumm
 

Glad it works for you 
 

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



Re: [PHP] XML to Array

2013-03-11 Thread Bastien Koert
On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com wrote:

 On Mar 10, 2013, at 6:03 AM, richard gray wrote:

 On 10/03/2013 11:47, Karl DeSaulniers wrote:

 Hi Guys,
 I am hoping someone can guide me or help me fix this issue.
 I have been lost in the code for some time now.
 I am trying to get the attributes of an xml node.
 I have this code:
 [snip]

 this may help -
 http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing

 I do admit I haven't the foggiest idea what I am doing here, so I am
 noobing out here on how this php function is really working.
 I got it off php.net and am trying to implement it in my code. Without my
 addition it works well except it doesn't grab any attributes
 which I need in order for my script to work properly.

 Any ideas on what I am doing wrong?

 TIA,


 HTH
 rich



 Thanks rich,
 That uses simpleXML. I am using xml_parse_create.
 Any ideas for xml_parse_create? I really like the way this function
 puts everything into an array that I can traverse. I only need it to put
 the attribute values in the array for the corresponding node and I am done.
 *Sigh

 Thanks for your help,

 Best,


 Karl DeSaulniers
 Design Drumm
 http://designdrumm.com


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


I came across this XML to JSON to an array some time ago. It might be something

function xmlToArray($xml)
{
return json_decode(json_encode((array) simplexml_load_string($xml)),1);
}

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] XML to Array

2013-03-11 Thread Karl DeSaulniers


On Mar 11, 2013, at 8:22 AM, Bastien Koert wrote:

On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:


Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]


this may help -
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing


I do admit I haven't the foggiest idea what I am doing here, so I  
am

noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my

addition it works well except it doesn't grab any attributes
which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,



HTH
rich




Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it  
to put
the attribute values in the array for the corresponding node and I  
am done.

*Sigh

Thanks for your help,

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



I came across this XML to JSON to an array some time ago. It might  
be something


function xmlToArray($xml)
{
	return json_decode(json_encode((array) simplexml_load_string($xml)), 
1);

}

--

Bastien

Cat, the other other white meat


Thanks Bastien!
That worked very well. I now see the attributes. However it does not  
load the root node?
I am going to need that node to display too. Any thoughts as to why it  
is not showing?
I just copied and pasted your code. I'm going to look at some docs to  
see if I can find out why,

but if you know, please let me know your solution. Thanks again.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] XML to Array

2013-03-11 Thread Karl DeSaulniers


On Mar 11, 2013, at 8:22 AM, Bastien Koert wrote:

On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers k...@designdrumm.com 
 wrote:


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:


Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]


this may help -
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing


I do admit I haven't the foggiest idea what I am doing here, so I  
am

noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my

addition it works well except it doesn't grab any attributes
which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,



HTH
rich




Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it  
to put
the attribute values in the array for the corresponding node and I  
am done.

*Sigh

Thanks for your help,

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



I came across this XML to JSON to an array some time ago. It might  
be something


function xmlToArray($xml)
{
	return json_decode(json_encode((array) simplexml_load_string($xml)), 
1);

}

--

Bastien

Cat, the other other white meat


Actually no, I don't need the root node after all.
Looks like it finally works! :)

Thank you Bastien! Nice one-liner.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] XML to Array

2013-03-10 Thread richard gray

On 10/03/2013 11:47, Karl DeSaulniers wrote:

Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]
this may help - 
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing
I do admit I haven't the foggiest idea what I am doing here, so I am 
noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code. Without 
my addition it works well except it doesn't grab any attributes

which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,


HTH
rich

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



Re: [PHP] XML to Array

2013-03-10 Thread Karl DeSaulniers


On Mar 10, 2013, at 6:03 AM, richard gray wrote:


On 10/03/2013 11:47, Karl DeSaulniers wrote:

Hi Guys,
I am hoping someone can guide me or help me fix this issue.
I have been lost in the code for some time now.
I am trying to get the attributes of an xml node.
I have this code:
[snip]

this may help - 
http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing
I do admit I haven't the foggiest idea what I am doing here, so I  
am noobing out here on how this php function is really working.
I got it off php.net and am trying to implement it in my code.  
Without my addition it works well except it doesn't grab any  
attributes

which I need in order for my script to work properly.

Any ideas on what I am doing wrong?

TIA,


HTH
rich



Thanks rich,
That uses simpleXML. I am using xml_parse_create.
Any ideas for xml_parse_create? I really like the way this function
puts everything into an array that I can traverse. I only need it to put
the attribute values in the array for the corresponding node and I am  
done.

*Sigh

Thanks for your help,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



RES: [PHP] XML/PHP web service

2012-08-09 Thread Alejandro Michelin Salomon
Philip :

Try this:

Client:

$client = new SoapClient( null, array( 'encoding' = 'utf-8', 'soap_version'
= SOAP_1_2, 'trace' = 1, 
 'uri' = 'tns: Server', 'location' = 'php
server URL here'));

// Cut off ?xml version=1.0 encoding=utf-8?, to not have two xml start
tag in the soap message.
$xmlres = $client-__soapCall( 'ProXML', array( str_replace( '?xml
version=1.0 encoding=utf-8?'.\n, '', $sXml )));

echo 'pre', $xmlres, '/pre'; // print the xml output or
var_export($xmlres, true) if $xmlres is an array.


SERVER:


class Receiver
{
public function ProXML ( $sXML )
{

libxml_use_internal_errors(true); // enabled use libxml errors

// try..catch to cacth simplexmlelement errors
try
{
$xml = new SimpleXMLElement( '?xml version=1.0
encoding=utf-8?' . $sXML ); // Try to create a xml object with the string
passed
} catch (Exception $e) {

$aErrors = libxml_get_errors(); // get errors

foreach ( $aErros as $oErro )
  {
switch ( $oErro-level )
{
case LIBXML_ERR_WARNING:
$sCod .= 'returncode' . $oErro-code .
'/codemenssage' . utf8_encode( 'warning: ' . $oErro-message ) .
'/menssage/return';
break;
case LIBXML_ERR_ERROR:
$sCod .= 'respostacodigo' . $oErro-code .
'/codemenssage' . utf8_encode( 'Error: ' . $oErro-message ) .
 '/menssage/return';
break;
 case LIBXML_ERR_FATAL:
$sCod .= 'respostacodigo' . $oErro-code .
'/codemenssage' . utf8_encode( ' Fatal Error: ' . $oErro-message ) .
 '/menssage/return';
 break;
}
 }
}

work here ...

}

}


$server = new SoapServer(null, array( 'uri' = 'tns: Server' ));

$server-setClass('Receiver');

$server-handle();




Alejandro M.S

-Mensagem original-
De: Phillip Baker [mailto:phil...@freewolf.net] 
Enviada em: quarta-feira, 8 de agosto de 2012 19:12
Para: php-general@lists.php.net
Assunto: [PHP] XML/PHP web service

Greetings all,

I am looking for some options here.

I am in need of creating a service on our web server that will always be
available and automated.
It will accept an XML file.

I will be checking to see if the XML file is valid and then passing it on to
another server.
But I need to accept this file without using a submit form.
I have never done anything like this and looking for ideas.

I am using a lamp environment and looking for suggestions.

I am looking to set this up so that our vendors can set up scripts to
automatically post XML files to our servers.

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused to
protect blacks from extra-legal violence. Given our history, it's stunning
we fail to question those who would force upon us a total reliance on the
state for defense.
-- Robert J. Cottrol


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



Re: RES: [PHP] XML/PHP web service

2012-08-09 Thread Carlos Medina
Hi,
the two options offers here are ok. But please make it secure!

Regards

Carlos

Am 09.08.2012 14:38, schrieb Alejandro Michelin Salomon:
 Philip :
 
 Try this:
 
 Client:
 
 $client = new SoapClient( null, array( 'encoding' = 'utf-8', 'soap_version'
 = SOAP_1_2, 'trace' = 1, 
  'uri' = 'tns: Server', 'location' = 'php
 server URL here'));
 
 // Cut off ?xml version=1.0 encoding=utf-8?, to not have two xml start
 tag in the soap message.
 $xmlres = $client-__soapCall( 'ProXML', array( str_replace( '?xml
 version=1.0 encoding=utf-8?'.\n, '', $sXml )));
 
 echo 'pre', $xmlres, '/pre'; // print the xml output or
 var_export($xmlres, true) if $xmlres is an array.
 
 
 SERVER:
 
 
 class Receiver
 {
 public function ProXML ( $sXML )
 {
 
 libxml_use_internal_errors(true); // enabled use libxml errors
 
 // try..catch to cacth simplexmlelement errors
 try
 {
 $xml = new SimpleXMLElement( '?xml version=1.0
 encoding=utf-8?' . $sXML ); // Try to create a xml object with the string
 passed
 } catch (Exception $e) {
 
 $aErrors = libxml_get_errors(); // get errors
 
   foreach ( $aErros as $oErro )
 {
 switch ( $oErro-level )
 {
 case LIBXML_ERR_WARNING:
 $sCod .= 'returncode' . $oErro-code .
 '/codemenssage' . utf8_encode( 'warning: ' . $oErro-message ) .
 '/menssage/return';
 break;
 case LIBXML_ERR_ERROR:
 $sCod .= 'respostacodigo' . $oErro-code .
 '/codemenssage' . utf8_encode( 'Error: ' . $oErro-message ) .
  '/menssage/return';
 break;
  case LIBXML_ERR_FATAL:
 $sCod .= 'respostacodigo' . $oErro-code .
 '/codemenssage' . utf8_encode( ' Fatal Error: ' . $oErro-message ) .
  '/menssage/return';
  break;
 }
  }
 }
 
 work here ...
 
 }
 
 }
 
 
 $server = new SoapServer(null, array( 'uri' = 'tns: Server' ));
 
 $server-setClass('Receiver');
 
 $server-handle();
 
 
 
 
 Alejandro M.S
 
 -Mensagem original-
 De: Phillip Baker [mailto:phil...@freewolf.net] 
 Enviada em: quarta-feira, 8 de agosto de 2012 19:12
 Para: php-general@lists.php.net
 Assunto: [PHP] XML/PHP web service
 
 Greetings all,
 
 I am looking for some options here.
 
 I am in need of creating a service on our web server that will always be
 available and automated.
 It will accept an XML file.
 
 I will be checking to see if the XML file is valid and then passing it on to
 another server.
 But I need to accept this file without using a submit form.
 I have never done anything like this and looking for ideas.
 
 I am using a lamp environment and looking for suggestions.
 
 I am looking to set this up so that our vendors can set up scripts to
 automatically post XML files to our servers.
 
 Blessed Be
 
 Phillip
 
 In the Jim Crow South, for example, government failed and indeed refused to
 protect blacks from extra-legal violence. Given our history, it's stunning
 we fail to question those who would force upon us a total reliance on the
 state for defense.
 -- Robert J. Cottrol
 


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



[PHP] XML/PHP web service

2012-08-08 Thread Phillip Baker
Greetings all,

I am looking for some options here.

I am in need of creating a service on our web server that will always be
available and automated.
It will accept an XML file.

I will be checking to see if the XML file is valid and then passing it on
to another server.
But I need to accept this file without using a submit form.
I have never done anything like this and looking for ideas.

I am using a lamp environment and looking for suggestions.

I am looking to set this up so that our vendors can set up scripts to
automatically post XML files to our servers.

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense.
-- Robert J. Cottrol


Re: [PHP] XML/PHP web service

2012-08-08 Thread Ashley Sheridan


Phillip Baker phil...@freewolf.net wrote:

Greetings all,

I am looking for some options here.

I am in need of creating a service on our web server that will always
be
available and automated.
It will accept an XML file.

I will be checking to see if the XML file is valid and then passing it
on
to another server.
But I need to accept this file without using a submit form.
I have never done anything like this and looking for ideas.

I am using a lamp environment and looking for suggestions.

I am looking to set this up so that our vendors can set up scripts to
automatically post XML files to our servers.

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed
refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total
reliance
on the state for defense.
-- Robert J. Cottrol

Just set up your php script as if it were accepting input from a form 
submission. All you're doing is not showing the form. Imagine it like a form 
set up on someone else's server with the action attribute pointing to your 
script.

Ashley  Sheridan
http://www.ashleysheridan.co.uk

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] XML/PHP web service

2012-08-08 Thread Phillip Baker
I was wondering how that would work and if it might be that simple.
How would I inform the client to hit the page (script)?

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense.
-- Robert J. Cottrol



On Wed, Aug 8, 2012 at 4:27 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:



 Phillip Baker phil...@freewolf.net wrote:

 Greetings all,
 
 I am looking for some options here.
 
 I am in need of creating a service on our web server that will always
 be
 available and automated.
 It will accept an XML file.
 
 I will be checking to see if the XML file is valid and then passing it
 on
 to another server.
 But I need to accept this file without using a submit form.
 I have never done anything like this and looking for ideas.
 
 I am using a lamp environment and looking for suggestions.
 
 I am looking to set this up so that our vendors can set up scripts to
 automatically post XML files to our servers.
 
 Blessed Be
 
 Phillip
 
 In the Jim Crow South, for example, government failed and indeed
 refused
 to protect blacks from extra-legal violence. Given our history, it's
 stunning we fail to question those who would force upon us a total
 reliance
 on the state for defense.
 -- Robert J. Cottrol

 Just set up your php script as if it were accepting input from a form
 submission. All you're doing is not showing the form. Imagine it like a
 form set up on someone else's server with the action attribute pointing to
 your script.

 Ashley  Sheridan
 http://www.ashleysheridan.co.uk

 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.



Re: [PHP] XML/PHP web service

2012-08-08 Thread Robert Cummings

Hi Philip,

Tell them they can POST submissions to:

https://www.acme.com/xml-submission

Then tell them what fields are supported. Presumably you will support 
the following POST fields as a minimum (as if they were on a form):


username
password
xml

Your handler should also provide some feedback about whether the 
submission was successful of not. You can simply return output of a 1 
for success, a 0 for failure, or if you want to go whole hog you can 
output an XML response for which you can have much greater granularity 
for the response.


Cheers,
Rob.

On 12-08-08 06:57 PM, Phillip Baker wrote:

I was wondering how that would work and if it might be that simple.
How would I inform the client to hit the page (script)?

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense.
-- Robert J. Cottrol



On Wed, Aug 8, 2012 at 4:27 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:




Phillip Baker phil...@freewolf.net wrote:


Greetings all,

I am looking for some options here.

I am in need of creating a service on our web server that will always
be
available and automated.
It will accept an XML file.

I will be checking to see if the XML file is valid and then passing it
on
to another server.
But I need to accept this file without using a submit form.
I have never done anything like this and looking for ideas.

I am using a lamp environment and looking for suggestions.

I am looking to set this up so that our vendors can set up scripts to
automatically post XML files to our servers.

Blessed Be

Phillip

In the Jim Crow South, for example, government failed and indeed
refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total
reliance
on the state for defense.
-- Robert J. Cottrol


Just set up your php script as if it were accepting input from a form
submission. All you're doing is not showing the form. Imagine it like a
form set up on someone else's server with the action attribute pointing to
your script.

Ashley  Sheridan
http://www.ashleysheridan.co.uk

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.





--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] XML enabled but not working

2011-09-16 Thread Richard Quadling
On 15 September 2011 21:20, Matthew Pounsett m...@conundrum.com wrote:
 Anyone have any thoughts on what to look at?

php -m

look for XML

php --rf xml_parser_create

look for

Function [ internal:xml function xml_parser_create ] {

  - Parameters [1] {
Parameter #0 [ optional $encoding ]
  }
}


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



Re: [PHP] XML enabled but not working

2011-09-16 Thread Matthew Pounsett

On 2011/09/16, at 10:27, Richard Quadling wrote:

 On 15 September 2011 21:20, Matthew Pounsett m...@conundrum.com wrote:
 Anyone have any thoughts on what to look at?
 
 php -m
 php --rf xml_parser_create

Thanks.  This seems to reinforce that there's something wrong, but I don't feel 
like I know any more about what's broken. :)

 php -m
[PHP Modules]
Core
date
ereg
libxml
mysqlnd
pcre
Reflection
SPL
standard

[Zend Modules]

 php --rf xml_parser_create
Exception: Function xml_parser_create() does not exist


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



Re: [PHP] XML enabled but not working

2011-09-16 Thread Richard Quadling
On 16 September 2011 23:18, Matthew Pounsett m...@conundrum.com wrote:

 On 2011/09/16, at 10:27, Richard Quadling wrote:

 On 15 September 2011 21:20, Matthew Pounsett m...@conundrum.com wrote:
 Anyone have any thoughts on what to look at?

 php -m
 php --rf xml_parser_create

 Thanks.  This seems to reinforce that there's something wrong, but I don't 
 feel like I know any more about what's broken. :)

 php -m
 [PHP Modules]
 Core
 date
 ereg
 libxml
 mysqlnd
 pcre
 Reflection
 SPL
 standard

 [Zend Modules]

 php --rf xml_parser_create
 Exception: Function xml_parser_create() does not exist



The xml_parser_create() function is in the XML extension, not in the
libxml extension.

php --re libxml
vs
php -d extension=php_xml.dll --re xml

Assuming php_xml.dll is available (may need to be .so rather than .dll
for non windows).

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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



[PHP] XML enabled but not working

2011-09-15 Thread Matthew Pounsett

I seems to behaving issues with php5 on one particular server, and I haven't 
been able to find the issue.  Basically, php says XML is enabled, but xml 
functions are missing.

 php -i | grep XML support
libXML support = active

 echo ? print xml_parser_create(''); ? | php
Fatal error: Call to undefined function xml_parser_create() in - on line 1

The machine in question is FreeBSD 8.2-RELEASE running the most recent ports of 
php5 and expat.

 php -v
PHP 5.3.8 with Suhosin-Patch (cli) (built: Sep 15 2011 13:58:49) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

 sudo portversion -v expat
expat-2.0.1_2   =  up-to-date with port 

What's baffling is that this is a basically identical configuration to another 
server where php is behaving just fine.  I haven't been able to find the 
variation yet.  

Anyone have any thoughts on what to look at?



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



Re: [PHP] XML enabled but not working

2011-09-15 Thread tamouse mailing lists
On Thu, Sep 15, 2011 at 3:20 PM, Matthew Pounsett m...@conundrum.com wrote:
 echo ? print xml_parser_create(''); ? | php

Not anything to do with the problem, but you can just write:

  php -r print xml_parser_create('');

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



[PHP] XML array

2011-07-05 Thread Kanishka
hi this is my first post on php general mailing list, i want to read a xml
file to retrieve data. i tried by using DOM and simple xml but i
couldn't.
the xml file looks like this..

*note
head
   titlethe the title/title
   date7-6-2011/date
/head

data
book
namebook 1/name
authorauthor 1/author
/book

book
namebook 2/name
authorauther 2/author
/book

/data
/note*

i want to put both name and author values in a multy dimensional array.
what dimension is suitable? what should i do for resolve my problem?
thanks.


Re: [PHP] XML array

2011-07-05 Thread Stuart Dallas
On Tue, Jul 5, 2011 at 4:36 PM, Kanishka kanishkani...@gmail.com wrote:

 hi this is my first post on php general mailing list, i want to read a xml
 file to retrieve data. i tried by using DOM and simple xml but i
 couldn't.
 the xml file looks like this..

 *note
 head
   titlethe the title/title
   date7-6-2011/date
 /head

 data
 book
 namebook 1/name
 authorauthor 1/author
 /book

 book
 namebook 2/name
 authorauther 2/author
 /book

 /data
 /note*

 i want to put both name and author values in a multy dimensional array.
 what dimension is suitable? what should i do for resolve my problem?


?php
$data =END
note
head
titlethe the title/title
date7-6-2011/date
/head
data
book
namebook 1/name
authorauthor 1/author
/book
book
namebook 2/name
authorauther 2/author
/book
/data
/note
END;

$xml = simplexml_load_string($data);

$arr = array();
foreach ($xml-data-book as $book)
{
$arr[] = array('name' = (string)$book-name, 'author' =
(string)$book-author);
}

var_dump($arr);
?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


Re: [PHP] XML array

2011-07-05 Thread Tamara Temple


On Jul 5, 2011, at 10:47 AM, Stuart Dallas wrote:



$arr[] = array('name' = (string)$book-name, 'author' =
(string)$book-author);
}


Interesting -- is the casting to string type necessary there? I  
haven't done that before, and it seems to have worked ok...



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



Re: [PHP] XML array

2011-07-05 Thread Stuart Dallas
On Tue, Jul 5, 2011 at 6:43 PM, Tamara Temple tamouse.li...@gmail.comwrote:


 On Jul 5, 2011, at 10:47 AM, Stuart Dallas wrote:


 $arr[] = array('name' = (string)$book-name, 'author' =
 (string)$book-author);
 }


 Interesting -- is the casting to string type necessary there? I haven't
 done that before, and it seems to have worked ok...


Depends whether you want strings or not. $book-name is a SimpleXMLElement
object, so if you want the string value it needs to be cast to a string.
This will be implicitly done if you use the variable where PHP would expect
a string, but in the name of defensive programming I always cast XML values
to the type I expect/want them to be.

Remove the casts in that snippet and run it - you'll see the variables are
not strings.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


Re: [PHP] XML array

2011-07-05 Thread Tamara Temple


On Jul 5, 2011, at 12:48 PM, Stuart Dallas wrote:

On Tue, Jul 5, 2011 at 6:43 PM, Tamara Temple  
tamouse.li...@gmail.com wrote:


On Jul 5, 2011, at 10:47 AM, Stuart Dallas wrote:


$arr[] = array('name' = (string)$book-name, 'author' =
(string)$book-author);
}

Interesting -- is the casting to string type necessary there? I  
haven't done that before, and it seems to have worked ok...


Depends whether you want strings or not. $book-name is a  
SimpleXMLElement object, so if you want the string value it needs to  
be cast to a string. This will be implicitly done if you use the  
variable where PHP would expect a string, but in the name of  
defensive programming I always cast XML values to the type I expect/ 
want them to be.


Remove the casts in that snippet and run it - you'll see the  
variables are not strings.


Ah, thanks for that information. I guess I have just been lucky so  
far. I will update my code and my style there to make it more accurate  
and defensible.





[PHP] XML Smart Home

2011-04-17 Thread Negin Nickparsa
i coded a smart home it has two jframes in java netbeans
it works correctly when i run the server and then when i run client
the devices such as radio,fan,...
i turn them on/off
but i want to store the changes when i run the server for the second time
someone told me that i must add xml code
does anyone know about it?


Re: [PHP] XML Smart Home

2011-04-17 Thread Daniel Brown
On Sun, Apr 17, 2011 at 11:34, Negin Nickparsa nickpa...@gmail.com wrote:
 i coded a smart home it has two jframes in java netbeans
 it works correctly when i run the server and then when i run client
 the devices such as radio,fan,...
 i turn them on/off
 but i want to store the changes when i run the server for the second time
 someone told me that i must add xml code
 does anyone know about it?

Sounds like a good question for your Java buddies.  This is
neither a Java nor XML list.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] XML Smart Home

2011-04-17 Thread Negin Nickparsa
php coders know about XML maybe u don't know but someone will reply me u'll
see


Re: [PHP] XML Smart Home

2011-04-17 Thread Daniel Brown
On Sun, Apr 17, 2011 at 11:38, Negin Nickparsa nickpa...@gmail.com wrote:
 php coders know about XML maybe u don't know but someone will reply me u'll
 see

What I see is someone who doesn't know how to help himself, who
thinks he's either smart or funny in his reply, and who has failed
miserably.

I repeat: this is a PHP list, not a Java or XML list.  Go
elsewhere to find out about that.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] XML Smart Home

2011-04-17 Thread Negin Nickparsa
i didn't want to be smart or funny cause i'm not
i just told my Idea
and i didn't want to bother list or Daniel
pardon me Daniel,for my bad behave if u think that was bad

ok i'll go


Re: [PHP] XML Smart Home

2011-04-17 Thread tedd

At 8:21 PM +0430 4/17/11, Negin Nickparsa wrote:

i didn't want to be smart or funny cause i'm not
i just told my Idea
and i didn't want to bother list or Daniel
pardon me Daniel,for my bad behave if u think that was bad

ok i'll go


That's probably a good thing for all.

On your next Mailing List, you should check out the Rules. Here's the 
rules for the php list:


http://us3.php.net/reST/php-src/trunk_README.MAILINGLIST_RULES

All Mailing List have similar rules -- it's best to read them before posting.

Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-04 Thread Richard Quadling
On 3 April 2011 21:38, Peter Lind peter.e.l...@gmail.com wrote:
 On 3 April 2011 22:35, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Thanks a lot! And is there a way to set (write) custom values in files
 other than php.ini? Sorry, didn't find such a function.


 I haven't come across any, but then again, I haven't had the need so
 never looked much ... It would be rather easy to generate though

 Regards
 Peter

 --
 hype
 WWW: plphp.dk / plind.dk
 LinkedIn: plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: kafe15
 /hype

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



For a truly quick and dirty config, then just use PHP.

A similar mechanism is used by PhD - the PHP Documentation building tool.

?php
// Create default config
$config = array('item1' = 'value1');

// Load the saved config.
$loadedConfig = include './config.inc';

// Merge configs.
$config = array_merge($config, $loadedConfig);

// Manipulate config.
$config['item1'] = 'value2';

// Save config.
file_put_contents('./config.inc', '?php return ' .
var_export($config, true) .';');
?



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



[PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Jason Pruim
So the subject says it all... And yes I know this isn't related to PHP but it's 
the weekend and I trust the opinions on this list more then any other list I 
have seen. I've been doing alot of reading on XML and honestly it looks pretty 
cool... BUT the question is... Is it truly useful or is it just another layer 
that we have to write?

From what I can tell it looks like it could stabilize some of my programming in 
regards to databases, and possibly if I have to move information from one 
application to another.

But is it worth the added coding or should I just interact with the pieces 
directly?

Thoughts? Questions? Flames? :)



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



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Ashley Sheridan
Jason Pruim li...@pruimphotography.com wrote:

So the subject says it all... And yes I know this isn't related to PHP
but it's the weekend and I trust the opinions on this list more then
any other list I have seen. I've been doing alot of reading on XML and
honestly it looks pretty cool... BUT the question is... Is it truly
useful or is it just another layer that we have to write?

From what I can tell it looks like it could stabilize some of my
programming in regards to databases, and possibly if I have to move
information from one application to another.

But is it worth the added coding or should I just interact with the
pieces directly?

Thoughts? Questions? Flames? :)



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

Personally I've always considered xml as a format only for transferring data. A 
lot of popular file formats are xml-based, such as the open office formats. 
Then there's things like xhtml, svg, etc which are all xml formats. Property 
thought out, xml can be used very well for internal or proprietary formats. If 
you need a guide on how not to do it, search the daily wtf archives for xml!


Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Per Jessen
Jason Pruim wrote:

 So the subject says it all... And yes I know this isn't related to PHP
 but it's the weekend and I trust the opinions on this list more then
 any other list I have seen. I've been doing alot of reading on XML and
 honestly it looks pretty cool... BUT the question is... Is it truly
 useful or is it just another layer that we have to write?

I started looking at XML about 8-9 years ago and at first dismissed it
as just another way to gobble up CPU-cycles.  Later on, I began to
appreciate some of the really cool stuff you can achieve with XSLT, and
today I would not want to be without XML. 


-- 
Per Jessen, Zürich (16.6°C)


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



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Peter Lind
Like every other technology, XML needs to have a use before it becomes
a useful tool. Just using XML because it's available quickly leads to
headaches, as it isn't the best tool for all scenarios (config files
written in XML for instance). That said, XML is awesome for a lot of
things ... however, without having a better grasp of XML you're
unlikely to know whether it'll fit your needs.

If for no other reason, learning XML and related technologies is worth
it simply because the rest of the world uses it. So get to know it,
then you'll be able to actually judge if your project can benefit from
it.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



[PHP] Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Andre Polykanine
Hello Peter,

Just because you mentioned config files.
What  would  you suggest me as better format for them? Database is not
available  yet  since  I  need to make a config file before creating a
database.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind peter.e.l...@gmail.com
To: Per Jessen
Date created: , 10:27:09 PM
Subject: [PHP] XML... Useful or another layer of complexity?


  Like every other technology, XML needs to have a use before it becomes
a useful tool. Just using XML because it's available quickly leads to
headaches, as it isn't the best tool for all scenarios (config files
written in XML for instance). That said, XML is awesome for a lot of
things ... however, without having a better grasp of XML you're
unlikely to know whether it'll fit your needs.

If for no other reason, learning XML and related technologies is worth
it simply because the rest of the world uses it. So get to know it,
then you'll be able to actually judge if your project can benefit from
it.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

-- 
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] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Peter Lind
On 3 April 2011 21:41, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Just because you mentioned config files.
 What  would  you suggest me as better format for them? Database is not
 available  yet  since  I  need to make a config file before creating a
 database.

For config files I would suggest plain text config files - in the style of

key = value

php has built-in functions for reading those, so parsing them is very
fast and easy. See
http://dk2.php.net/manual/en/function.parse-ini-file.php

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Camilo Sperberg

El 03-04-11 14:41, Jason Pruim escribió:

So the subject says it all... And yes I know this isn't related to PHP but it's 
the weekend and I trust the opinions on this list more then any other list I 
have seen. I've been doing alot of reading on XML and honestly it looks pretty 
cool... BUT the question is... Is it truly useful or is it just another layer 
that we have to write?

 From what I can tell it looks like it could stabilize some of my programming 
in regards to databases, and possibly if I have to move information from one 
application to another.

But is it worth the added coding or should I just interact with the pieces 
directly?

Thoughts? Questions? Flames? :)
I think it is pretty useful, not for internals, but to communicate with 
other apps such as Adobe Flash or any other system which involves 
trespassing information.


SimpleXML is very easy to work with, you'll only need a valid XML file 
to read in case of reading. If you need CDATA support, SimpleXML can be 
extended with this:

http://coffeerings.posterous.com/php-simplexml-and-cdata

Greetings.

--
unreal4u.com http://unreal4u.com/
CHW http://www.chw.net/
Mi Twitter http://twitter.com/unreal4u


Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Jason Pruim

On Apr 3, 2011, at 3:31 PM, mrfroasty wrote:

 On 04/03/2011 08:41 PM, Jason Pruim wrote:
 
 So the subject says it all... And yes I know this isn't related to PHP but 
 it's the weekend and I trust the opinions on this list more then any other 
 list I have seen. I've been doing alot of reading on XML and honestly it 
 looks pretty cool... BUT the question is... Is it truly useful or is it just 
 another layer that we have to write?
 
 From what I can tell it looks like it could stabilize some of my programming 
 in regards to databases, and possibly if I have to move information from one 
 application to another.
 
 But is it worth the added coding or should I just interact with the pieces 
 directly?
 
 Thoughts? Questions? Flames? :)
 
 
 
 Not sure about specific situations, but if I have to write my own application 
 to application data transfer i wouldnt add such a complexity.I would just 
 create my own data like objects/arrays serialized and send them over via http 
 post or any easy means.And i will be done in few minutes, problem solved!.
 
 I have once created orders in xml for myself and send over via ftp to another 
 application.But this was just due to a fact that I had the scripts in place 
 to do the job.It looks much matured though, than if I had transfer the orders 
 in text format.
 
 But as I said, this depends on particular situations and problem on the 
 table.All cases where I worked with xml, were me receiving data from client 
 either via soap,xml files etc.Here I have no choice I have to work with xml 
 ofcourse.
 
 P:S
 **How could you stabilize your scripts by adding xml ?
 

I was thinking along the lines of using it as a intermediary.. Basically make a 
system that would take my raw data, throw it into XML, and then out to the web, 
database, or something else I haven't thought of.. If I was going into database 
I could create an abstraction layer using XML and format all the data before 
inserting it into specific fields... 

Now that I typed it I'm not sure it would work like I want it to But that 
was my thinking at the time.

Although I could write a system that would generate the XML from content in a 
database and then parse it as an rss feed, and insert it into a calendar 
system... (If that was needed)

Right now the question is purely academic  so I'm coming up with this stuff as 
I'm typing hehe :)




Re: [PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Peter Lind
On 3 April 2011 22:35, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Thanks a lot! And is there a way to set (write) custom values in files
 other than php.ini? Sorry, didn't find such a function.


I haven't come across any, but then again, I haven't had the need so
never looked much ... It would be rather easy to generate though

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



[PHP] XML with PHP

2010-08-26 Thread user

Hi

I am trying to read XML files (invoices) from a directory and display 
them to the visitor. Each XML file contains several invoices. The 
visitor then clicks on the XML file (invoices). My PHP snippet should 
open the xml file and locate the appropriate invoice and display the 
content.


I have managed to list the directory contents using the following PHP 
snippet. The function call below DisplayBill($MemberId, $FileName, 
$StyleSheet) should take the memberid (login), the xml file name which 
has been clicked and the stylesheet to be used.


I now have the following doubts for which I need clarifications

Architecturally is it necessary the DisplayBill should be a seperate php 
file or can it exist as a function in the same file as the code below?


Should the Invoices be displayed as a web form for me to capture the 
user click to retrieve the appropriate file and invoice so that I can 
display it to the user.


I intend to parse the XML file using XPath (at this stage I am not sure 
if php supports Xpath and XQuery!)


Any help would be appreciated

Best regards

Sridhar

-

?php
$BillLocation = /home/cmi/Integration/xml_files;
$StyleSheet = Bill.xsl;
$DirHandle = opendir($BillLocation);
echo table border=\1\;
echo tr;
While (($FileName = readdir($DirHandle)) !== false)
{
if ($FileName != .  $FileName != ..)
{
if (strpos($FileName, xml) !== false)
{
$BillYear = substr($FileName, 0, 4);
$BillMonth = substr($FileName, 5, 2);
switch ($BillMonth)
{
case 01:
$BillMonth = January;
break;
case 02:
$BillMonth = February;
break;
case 03:
$BillMonth = March;
break;
case 04:
$BillMonth = April;
break;
case 05:
$BillMonth = May;
break;
case 06:
$BillMonth = June;
break;
case 07:
$BillMonth = July;
break;
case 08:
$BillMonth = August;
break;
case 09:
$BillMonth = September;
break;
case 10:
$BillMonth = October;
break;
case 11:
$BillMonth = November;
break;
case 12:
$BillMonth = December;
break;
}
			echo td . a href='$FileName'$BillMonth .   . 
$BillYear/a . /td . \n;

echo /tr;

}
}
}
echo /table;
closedir($DirHandle);

$result = DisplayBill($MemberId, $FileName, $StyleSheet);

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



Re: [PHP] XML with PHP

2010-08-26 Thread Michael Shadle
On Thu, Aug 26, 2010 at 2:54 AM,  u...@domain.invalid wrote:
 Hi

 I am trying to read XML files (invoices) from a directory and display them
 to the visitor. Each XML file contains several invoices. The visitor then
 clicks on the XML file (invoices). My PHP snippet should open the xml file
 and locate the appropriate invoice and display the content.

a) first, your email address isn't correct

b) second, it looks like you intend on applying a stylesheet to get
your results. if you don't require XSL, you could look at just using
PHP's simplexml and/or XML DOM functions. it looks like you might just
be using the XSL to transform the XML anwyay; so from what it looks
like you -do not- need XSL in the mix.

c) you can put the PHP in any file you want

d) i believe xpath should work without any problems.

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



Re: [PHP] XML with PHP

2010-08-26 Thread Michael Shadle
On Thu, Aug 26, 2010 at 3:10 AM, Sridhar Pandurangiah
sridharpa...@gmail.com wrote:
 Mike

 Thanks a ton for the quick response. I have updated the mail id on my email
 client (using Mozilla TB) and I did repost but your reply was quicker!

 Will try this out and post the results on this thread. Just waiting for
 someone to throw light on how to capture the filename that the user
 clicked. Should I display the directory listing as a form?

honestly, that's a little bit too i'm writing code and solving all
your problems for you for me... it's hard to concentrate, i have to
actually do the code, not read about it and try to figure it out from
a description :)

feel free to pastebin it, if i don't help you quick maybe someone else will.

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



[PHP] XML with PHP

2010-08-26 Thread Sridhar Pandurangiah

Hi

I am trying to read XML files (invoices) from a directory and display
them to the visitor. Each XML file contains several invoices. The
visitor then clicks on the XML file (invoices). My PHP snippet should
open the xml file and locate the appropriate invoice and display the
content.

I have managed to list the directory contents using the following PHP
snippet. The function call below DisplayBill($MemberId, $FileName,
$StyleSheet) should take the memberid (login), the xml file name which
has been clicked and the stylesheet to be used.

I now have the following doubts for which I need clarifications

Architecturally is it necessary the DisplayBill should be a seperate php
file or can it exist as a function in the same file as the code below?

Should the Invoices be displayed as a web form for me to capture the
user click to retrieve the appropriate file and invoice so that I can
display it to the user.

I intend to parse the XML file using XPath (at this stage I am not sure
if php supports Xpath and XQuery!)

Any help would be appreciated

Best regards

Sridhar

-

?php
$BillLocation = /home/cmi/Integration/xml_files;
$StyleSheet = Bill.xsl;
$DirHandle = opendir($BillLocation);
echo table border=\1\;
echo tr;
While (($FileName = readdir($DirHandle)) !== false)
{
if ($FileName != .  $FileName != ..)
{
if (strpos($FileName, xml) !== false)
{
$BillYear = substr($FileName, 0, 4);
$BillMonth = substr($FileName, 5, 2);
switch ($BillMonth)
{
case 01:
$BillMonth = January;
break;
case 02:
$BillMonth = February;
break;
case 03:
$BillMonth = March;
break;
case 04:
$BillMonth = April;
break;
case 05:
$BillMonth = May;
break;
case 06:
$BillMonth = June;
break;
case 07:
$BillMonth = July;
break;
case 08:
$BillMonth = August;
break;
case 09:
$BillMonth = September;
break;
case 10:
$BillMonth = October;
break;
case 11:
$BillMonth = November;
break;
case 12:
$BillMonth = December;
break;
}
echo td . a href='$FileName'$BillMonth .   .
$BillYear/a . /td . \n;
echo /tr;

}
}
}
echo /table;
closedir($DirHandle);

$result = DisplayBill($MemberId, $FileName, $StyleSheet);

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



Re: [PHP] XML with PHP

2010-08-26 Thread Sridhar Pandurangiah

Hi

I guess my post was misunderstood. I was just trying to figure out if 
there is a better way other than displaying a form. That's the reason I 
posted my php snippet in my first post.


Thanks for the help.

Best regards

Sridhar

 Original Message 
Subject: Re: [PHP] XML with PHP
From: mike...@gmail.com (Michael Shadle)
To:
Date: Thu Aug 26 2010 15:43:33 GMT+0530 (IST)

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



Re: [PHP] XML with PHP

2010-08-26 Thread Sridhar Pandurangiah

Mike

Thanks a ton for the quick response. I have updated the mail id on my 
email client (using Mozilla TB) and I did repost but your reply was quicker!


Will try this out and post the results on this thread. Just waiting for 
someone to throw light on how to capture the filename that the user 
clicked. Should I display the directory listing as a form?


Best regards

Sridhar

 Original Message 
Subject: Re: [PHP] XML with PHP
From: mike...@gmail.com (Michael Shadle)
To:
Date: Thu Aug 26 2010 15:32:13 GMT+0530 (IST)


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



Re: [PHP] xml/cap problems

2010-08-22 Thread Adam Richardson
On Sat, Aug 21, 2010 at 5:53 PM, Tom Shaw ts...@oitc.com wrote:

 I am trying to decode and encode nws compatible cap xml. An example is at
 the bottom of this post. simplexml_load_file works fine if cap: is removed
 before processing. However, if it is not simplexml_load_file does not parse
 the file at all and libxml_get_errors returns no errors.

 Any and all help is appreciated.

 Tom

 ?xml version='1.0' encoding='UTF-8' standalone='yes'?
 cap:alert xmlns:cap='http://www.incident.com/cap/1.0'
 cap:identifierNOAA-NWS-ALERTS National
 2010-08-21T13:26:34-04:00/cap:identifier
 cap:senderw-nws.webmas...@noaa.gov/cap:sender
 cap:sent2010-08-21T13:26:34-04:00/cap:sent
 cap:statusActual/cap:status
 cap:msgTypeAlert/cap:msgType
 cap:scopePublic/cap:scope
 cap:note
 Current Watches, Warnings and Advisories for the United States Issued by
 the National Weather Service
 /cap:note
 cap:referenceshttp://www.weather.gov/alerts/us.html/cap:references
 cap:info
 cap:categoryMet/cap:category
 cap:eventna/cap:event
 cap:urgencyUnknown/cap:urgency
 cap:severityUnknown/cap:severity
 cap:certaintyUnknown/cap:certainty
 cap:headline
 Current Watches, Warnings and Advisories for Alaska Issued by the National
 Weather Service
 /cap:headline
 cap:webhttp://www.weather.gov/alerts/us.html#ak/cap:web
 /cap:info
 


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


Hi Tom,

Remember, the namespace is the uri, and the prefix is merely a short-hand:
http://www.w3.org/TR/REC-xml-names/

http://www.w3.org/TR/REC-xml-names/When using simple xml objects, you can
directly reference elements by using the namespace:
http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/

http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/However,
my preference is to use XPath capabilities, and I've processed a couple
elements on your example to demonstrate how this works:

$doc = EOD
test xmlns:cap='http://www.incident.com/cap/1.0'
cap:alert
cap:identifierNOAA-NWS-ALERTS National
2010-08-21T13:26:34-04:00/cap:identifier
cap:senderw-nws.webmas...@noaa.gov/cap:sender
cap:sent2010-08-21T13:26:34-04:00/cap:sent
cap:statusActual/cap:status
cap:msgTypeAlert/cap:msgType
cap:scopePublic/cap:scope
cap:note
Current Watches, Warnings and Advisories for the United States Issued by the
National Weather Service
/cap:note
cap:referenceshttp://www.weather.gov/alerts/us.html/cap:references
cap:info
cap:categoryMet/cap:category
cap:eventna/cap:event
cap:urgencyUnknown/cap:urgency
cap:severityUnknown/cap:severity
cap:certaintyUnknown/cap:certainty
cap:headline
Current Watches, Warnings and Advisories for Alaska Issued by the National
Weather Service
/cap:headline
cap:webhttp://www.weather.gov/alerts/us.html#ak/cap:web
/cap:info
/cap:alert
/test

EOD;
echo $doc;

$cap = simplexml_load_string($doc);
$cap-registerXPathNamespace('cap', 'http://www.incident.com/cap/1.0');
echo 'Message type:'.current($cap-xpath('//cap:msgType')).'br /';
echo 'Info category:'.current($cap-xpath('//cap:info/cap:category')).'br
/';

Hope this helps,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


[PHP] xml/cap problems

2010-08-21 Thread Tom Shaw
I am trying to decode and encode nws compatible cap xml. An example 
is at the bottom of this post. simplexml_load_file works fine if 
cap: is removed before processing. However, if it is not 
simplexml_load_file does not parse the file at all and 
libxml_get_errors returns no errors.


Any and all help is appreciated.

Tom

?xml version='1.0' encoding='UTF-8' standalone='yes'?
cap:alert xmlns:cap='http://www.incident.com/cap/1.0'
cap:identifierNOAA-NWS-ALERTS National 
2010-08-21T13:26:34-04:00/cap:identifier

cap:senderw-nws.webmas...@noaa.gov/cap:sender
cap:sent2010-08-21T13:26:34-04:00/cap:sent
cap:statusActual/cap:status
cap:msgTypeAlert/cap:msgType
cap:scopePublic/cap:scope
cap:note
Current Watches, Warnings and Advisories for the United States Issued 
by the National Weather Service

/cap:note
cap:referenceshttp://www.weather.gov/alerts/us.html/cap:references
cap:info
cap:categoryMet/cap:category
cap:eventna/cap:event
cap:urgencyUnknown/cap:urgency
cap:severityUnknown/cap:severity
cap:certaintyUnknown/cap:certainty
cap:headline
Current Watches, Warnings and Advisories for Alaska Issued by the 
National Weather Service

/cap:headline
cap:webhttp://www.weather.gov/alerts/us.html#ak/cap:web
/cap:info



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



Re: [PHP] XML DOM

2010-07-22 Thread Benjamin Hawkes-Lewis
On 21 Jul 2010, at 19:32, Ben Miller wrote:
 Problem:
 
 If street2 (or any other field) has no value, PHP is outputting the XML node
 as street2 /, which is producing a JS error when I try to call:
 
 script type=text/javascript..
 
 street2 = x[i].getElementsByTagName(street2)[0].childNodes[0].nodeValue;
 
.../script   (Because the requested node has no
 .nodeValue, I'm assuming???)
 
 
 
 Question:
 
 Can I tell PHP to output the XML node as street2/street2 instead of
 street2 / so that JS sees that the object has a value, but the value is 
 (blank)?

street2foo/street2 is syntax that means a street2 element with one 
child node: text node foo.

street2/street2 and street2 / are different syntax that mean the same 
thing: a street2 element with no child nodes.

Your JS property lookup fails because the street2 element has no child nodes. 
Rather than changing your XML serialization to have some sort of opaque 
meaning, why not do one of the following in your JS?

   1. Test to see if the element in question has any child nodes before 
attempting to access the first one:

   if (x[i].getElementsByTagName(street2)[0].childNodes.length  0) ...

   2. Use the textContent and innerText properties to get the text of 
all/any child nodes.

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



[PHP] XML parser

2010-07-13 Thread ppps...@gmail.com

Hello. I have html:
h3Header/h3
pParagraph 1/p

pParagraph n/p

div
h3Header/h3
pParagraph 1/p

pParagraph n/p
/div

need to parse it like this array:
array(
[0] = array(
'h3' = 'header' ,
'p' = array(
[0] = 'Paragraph 1' ,
[n-1] = 'Paragraph N'
)
[1] = array(
['div'] = array (
'h3' = 'header' ,
'p' = array(
[0] = 'Paragraph 1' ,
[n-1] = 'Paragraph N'
)
) ;

maybe simple other. Which pear class i can use for this task ?




Re: [PHP] XML parser

2010-07-13 Thread Andrew Ballard
On Tue, Jul 13, 2010 at 10:14 AM, ppps...@gmail.com ppps...@gmail.com wrote:
 Hello. I have html:
 h3Header/h3
 pParagraph 1/p
 
 pParagraph n/p

 div
 h3Header/h3
 pParagraph 1/p
    
 pParagraph n/p
 /div

 need to parse it like this array:
 array(
 [0] = array(
 'h3' = 'header' ,
 'p' = array(
 [0] = 'Paragraph 1' ,
 [n-1] = 'Paragraph N'
 )
 [1] = array(
 ['div'] = array (
 'h3' = 'header' ,
 'p' = array(
 [0] = 'Paragraph 1' ,
 [n-1] = 'Paragraph N'
 )
 ) ;

 maybe simple other. Which pear class i can use for this task ?




Why PEAR? That looks almost exactly like SimpleXML.

Andrew

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



[PHP] XML functions

2010-03-06 Thread Ahmad F AlTwaijiry

Dears

When i checked the php manual i found many Solutions to read/write xml  
files and im confused now :)


Which function/library is better and is there any new article that  
compare each function/library?


Thanks

Ahmad AlTwaijiry
http://www.AlTwaijiry.com

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



Re: [PHP] XML functions

2010-03-06 Thread Andre Polykanine
Hello Ahmad and all,

  I will expand a little bit your question joining to it: what is
  the better technique to make an RSS feed on the website? The
  website is manually written, no CMS.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ahmad F AlTwaijiry ah...@altwaijiry.com
To: php-general@lists.php.net php-general@lists.php.net
Date: Saturday, March 6, 2010, 7:00:04 PM
Subject: [PHP] XML functions

Dears

When i checked the php manual i found many Solutions to read/write xml  
files and im confused now :)

Which function/library is better and is there any new article that  
compare each function/library?

Thanks

Ahmad AlTwaijiry
http://www.AlTwaijiry.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] XML functions

2010-03-06 Thread Ashley Sheridan
On Sat, 2010-03-06 at 21:50 +0200, Andre Polykanine wrote:

 Hello Ahmad and all,
 
   I will expand a little bit your question joining to it: what is
   the better technique to make an RSS feed on the website? The
   website is manually written, no CMS.
 -- 
 With best regards from Ukraine,
 Andre
 Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
 jabber.org
 Yahoo! messenger: andre.polykanine; ICQ: 191749952
 Twitter: m_elensule
 
 - Original message -
 From: Ahmad F AlTwaijiry ah...@altwaijiry.com
 To: php-general@lists.php.net php-general@lists.php.net
 Date: Saturday, March 6, 2010, 7:00:04 PM
 Subject: [PHP] XML functions
 
 Dears
 
 When i checked the php manual i found many Solutions to read/write xml  
 files and im confused now :)
 
 Which function/library is better and is there any new article that  
 compare each function/library?
 
 Thanks
 
 Ahmad AlTwaijiry
 http://www.AlTwaijiry.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


That's a very different question, and ought to be in a new thread.
Please don't hijack threads like this.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] XML functions

2010-03-06 Thread Michael A. Peters

Ahmad F AlTwaijiry wrote:

Dears

When i checked the php manual i found many Solutions to read/write xml 
files and im confused now :)


Which function/library is better and is there any new article that 
compare each function/library?


I use DOMDocument.
It works best if the input file you are reading is UTF-8.

It has some issues I haven't yet figured out related to namespaces, 
sometimes when loading perfectly valid XML that uses namespaces for 
import into another document, I lose the namespace and get default 
prepended to the node name. I do not understand why it feels it needs to 
do this, but it apparently does in some cases.


For those cases, I currently use hackish workarounds where I remove the 
namespace with a preg_replace before import into the DOM and then add 
the namespace again using the DOM tools after it has been imported.


Where I have run into this problem is MathML and SVG within XHTML when I 
cache the MathML/SVG as a string in APC for import into documents.


It is not so much an issue with SVG in XHTML as SVG probably is best 
done as an object rather than directly embedded (but when generating SVG 
via DOMDocument I have a similar problem if I am using xlink namespace) 
but it is a problem with MathML which is usually done inline.


It could just be that I'm doing things wrong, but the documentation 
isn't exactly full of working example code.


So anyway, if you use namespaces, you may run into a few frustrating 
kinks, but DOMDocument is what I use, and it is very convenient because 
it is very similar to the JavaScript DOM2 methods (I believe intentionally).


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



Re: [PHP] XML functions

2010-03-06 Thread Michael A. Peters

Andre Polykanine wrote:

Hello Ahmad and all,

  I will expand a little bit your question joining to it: what is
  the better technique to make an RSS feed on the website? The
  website is manually written, no CMS.


I wrote a class to do it -

http://www.phpclasses.org/browse/package/5942.html

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



[PHP] XML parsing with PHP

2009-10-22 Thread Mari Masuda

Hi,

I need to transform some XML files and have not really done much  
XSLT.  I am looking for recommendations on ways to parse XML via  
PHP.  The XML files I have contain the content from our website CMS.   
We are switching from a proprietary CMS to Drupal and I need to  
transform the XML into .csv (comma separated) so I can suck the data  
into MySQL.  Any suggestions are appreciated.  Thanks!


Mari

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



RE: [PHP] XML parsing with PHP

2009-10-22 Thread Jay Blanchard
[snip] I need to transform some XML files and have not really done much

XSLT.  I am looking for recommendations on ways to parse XML via  
PHP.  The XML files I have contain the content from our website CMS.   
We are switching from a proprietary CMS to Drupal and I need to  
transform the XML into .csv (comma separated) so I can suck the data  
into MySQL.  Any suggestions are appreciated.  Thanks![/snip]


http://www.php.net/xml


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



[PHP] XML RSS - Unexpected End of File error

2009-10-08 Thread Ashley Sheridan
Hi guys,

I've knocked up a quick RSS feed on my site. It works fine in Fx 2  3,
in Opera it throws an error unexpected end of file but allows the feed
to be added anyway, and Chrome just says there's an XML error, and gives
the second from last line as the one containing the error.

I tried adding a newline to the end of the file, but that just makes the
error message report the next line. Any ideas where I'm going wrong? The
file is using utf-8 character encoding.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] XML RSS - Unexpected End of File error

2009-10-08 Thread Jonathan Tapicer
Can you show the generated XML?

Jonathan

On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 Hi guys,

 I've knocked up a quick RSS feed on my site. It works fine in Fx 2  3,
 in Opera it throws an error unexpected end of file but allows the feed
 to be added anyway, and Chrome just says there's an XML error, and gives
 the second from last line as the one containing the error.

 I tried adding a newline to the end of the file, but that just makes the
 error message report the next line. Any ideas where I'm going wrong? The
 file is using utf-8 character encoding.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




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



Re: [PHP] XML RSS - Unexpected End of File error

2009-10-08 Thread Ashley Sheridan
On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote:

 Can you show the generated XML?
 
 Jonathan
 
 On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  Hi guys,
 
  I've knocked up a quick RSS feed on my site. It works fine in Fx 2  3,
  in Opera it throws an error unexpected end of file but allows the feed
  to be added anyway, and Chrome just says there's an XML error, and gives
  the second from last line as the one containing the error.
 
  I tried adding a newline to the end of the file, but that just makes the
  error message report the next line. Any ideas where I'm going wrong? The
  file is using utf-8 character encoding.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 

Nevermind, I was having a moment! I'd forgotten to close the final
tag, as I mistook the root rss tag for an XML declaration instead! I
am a little surprised that Fx allowed it to validate correctly though!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] XML RSS - Unexpected End of File error

2009-10-08 Thread Jim Lucas
Ashley Sheridan wrote:
 On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote:
 
 Can you show the generated XML?

 Jonathan

 On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 Hi guys,

 I've knocked up a quick RSS feed on my site. It works fine in Fx 2  3,
 in Opera it throws an error unexpected end of file but allows the feed
 to be added anyway, and Chrome just says there's an XML error, and gives
 the second from last line as the one containing the error.

 I tried adding a newline to the end of the file, but that just makes the
 error message report the next line. Any ideas where I'm going wrong? The
 file is using utf-8 character encoding.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



 
 Nevermind, I was having a moment! I'd forgotten to close the final
 tag, as I mistook the root rss tag for an XML declaration instead! I
 am a little surprised that Fx allowed it to validate correctly though!
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 

Well, don't forget, Fx will correct SGML and HTML that is missing tags.

I think Fx would rather simply accept the incorrect format, correct it (since it
wasn't a fatal error), and finally display what it figures you /intended/ to
send it.

I hate it when software tries to assume what I meant to say...  :-(

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



Re: [PHP] XML RSS - Unexpected End of File error

2009-10-08 Thread Ashley Sheridan
On Thu, 2009-10-08 at 12:50 -0700, Jim Lucas wrote:

 Ashley Sheridan wrote:
  On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote:
  
  Can you show the generated XML?
 
  Jonathan
 
  On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  Hi guys,
 
  I've knocked up a quick RSS feed on my site. It works fine in Fx 2  3,
  in Opera it throws an error unexpected end of file but allows the feed
  to be added anyway, and Chrome just says there's an XML error, and gives
  the second from last line as the one containing the error.
 
  I tried adding a newline to the end of the file, but that just makes the
  error message report the next line. Any ideas where I'm going wrong? The
  file is using utf-8 character encoding.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
  
  Nevermind, I was having a moment! I'd forgotten to close the final
  tag, as I mistook the root rss tag for an XML declaration instead! I
  am a little surprised that Fx allowed it to validate correctly though!
  
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
  
  
  
 
 Well, don't forget, Fx will correct SGML and HTML that is missing tags.
 
 I think Fx would rather simply accept the incorrect format, correct it (since 
 it
 wasn't a fatal error), and finally display what it figures you /intended/ to
 send it.
 
 I hate it when software tries to assume what I meant to say...  :-(
 


I'm just used to it letting me know if I was trying to view malformed
XML. It must be a special case for RSS as it recognises the format as
being special!

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Matthew Croud


Hiya,
I'm writing an app that let's my client upload images, the image html  
code is added to an XML file.

Take a look at the image element below:

item Code=e1022
codee1022/code
image![CDATA[img src=uploads/image2.jpg alt=Homepage  
Image width=124 height=70 /]]/image

nameBlue Ski Trousers/name
price8.99/price
  /item

Now, whenever PHP writes this to the XML files, it turns the  and   
into lt; and gt; . which means it does not display on the webpage.   
How can I prevent this from happening ?


Many thanks,
Matt


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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Bastien Koert
On Wed, Sep 9, 2009 at 5:27 AM, Matthew Croudm...@obviousdigital.com wrote:

 Hiya,
 I'm writing an app that let's my client upload images, the image html code
 is added to an XML file.
 Take a look at the image element below:

 item Code=e1022
    codee1022/code
    image![CDATA[img src=uploads/image2.jpg alt=Homepage Image
 width=124 height=70 /]]/image
    nameBlue Ski Trousers/name
    price8.99/price
  /item

 Now, whenever PHP writes this to the XML files, it turns the  and  into
 lt; and gt; . which means it does not display on the webpage.  How can I
 prevent this from happening ?

 Many thanks,
 Matt


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



str_replace?


-- 

Bastien

Cat, the other other white meat

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



RE: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Bob McConnell
From: Bastien Koert
 On Wed, Sep 9, 2009 at 5:27 AM, Matthew Croudm...@obviousdigital.com wrote:

 Hiya,
 I'm writing an app that let's my client upload images, the image html code
 is added to an XML file.
 Take a look at the image element below:

 item Code=e1022
    codee1022/code
    image![CDATA[img src=uploads/image2.jpg alt=Homepage Image
 width=124 height=70 /]]/image
    nameBlue Ski Trousers/name
    price8.99/price
  /item

 Now, whenever PHP writes this to the XML files, it turns the  and  into
 lt; and gt; . which means it does not display on the webpage.  How can I
 prevent this from happening ?

 
 str_replace?
 

Does the xml string get passed to htmlentities() or a similar function before 
it is sent to the browser? That would explain the substitutions. I saw an 
xmlentities() variation mentioned somewhere.

Bob McConnell

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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Matthew Croud


On 9 Sep 2009, at 14:26, Bastien Koert wrote:

On Wed, Sep 9, 2009 at 5:27 AM, Matthew  
Croudm...@obviousdigital.com wrote:


Hiya,
I'm writing an app that let's my client upload images, the image  
html code

is added to an XML file.
Take a look at the image element below:

item Code=e1022
   codee1022/code
   image![CDATA[img src=uploads/image2.jpg alt=Homepage Image
width=124 height=70 /]]/image
   nameBlue Ski Trousers/name
   price8.99/price
 /item

Now, whenever PHP writes this to the XML files, it turns the  and  
 into
lt; and gt; . which means it does not display on the webpage.   
How can I

prevent this from happening ?

Many thanks,
Matt


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




str_replace?


--

Bastien

Cat, the other other white meat



I've tried that but no matter what i do in the PHP side of things, as  
soon as I save that XML the conversion takes place.
Should the XML be encoded in any way, is there a setting somewhere  
that prevents this ?


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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Eddie Drapkin
On Wed, Sep 9, 2009 at 9:33 AM, Matthew Croud m...@obviousdigital.com wrote:

 On 9 Sep 2009, at 14:26, Bastien Koert wrote:

 On Wed, Sep 9, 2009 at 5:27 AM, Matthew Croudm...@obviousdigital.com
 wrote:

 Hiya,
 I'm writing an app that let's my client upload images, the image html
 code
 is added to an XML file.
 Take a look at the image element below:

 item Code=e1022
   codee1022/code
   image![CDATA[img src=uploads/image2.jpg alt=Homepage Image
 width=124 height=70 /]]/image
   nameBlue Ski Trousers/name
   price8.99/price
  /item

 Now, whenever PHP writes this to the XML files, it turns the  and  into
 lt; and gt; . which means it does not display on the webpage.  How can
 I
 prevent this from happening ?

 Many thanks,
 Matt


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



 str_replace?


 --

 Bastien

 Cat, the other other white meat


 I've tried that but no matter what i do in the PHP side of things, as soon
 as I save that XML the conversion takes place.
 Should the XML be encoded in any way, is there a setting somewhere that
 prevents this ?

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



Perhaps you'd be so kind as to share with us what code you're using to
generate the erroneous XML?

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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Matthew Croud


On 9 Sep 2009, at 14:36, Bob McConnell wrote:


From: Bastien Koert
On Wed, Sep 9, 2009 at 5:27 AM, Matthew  
Croudm...@obviousdigital.com wrote:


Hiya,
I'm writing an app that let's my client upload images, the image  
html code

is added to an XML file.
Take a look at the image element below:

item Code=e1022
   codee1022/code
   image![CDATA[img src=uploads/image2.jpg alt=Homepage  
Image

width=124 height=70 /]]/image
   nameBlue Ski Trousers/name
   price8.99/price
 /item

Now, whenever PHP writes this to the XML files, it turns the  and  
 into
lt; and gt; . which means it does not display on the webpage.   
How can I

prevent this from happening ?



str_replace?



Does the xml string get passed to htmlentities() or a similar  
function before it is sent to the browser? That would explain the  
substitutions. I saw an xmlentities() variation mentioned somewhere.


Bob McConnell

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




Hi Bob,

Nope the string doesn't get passed into any function.
Here is the XML:
_

?xml version=1.0 encoding=UTF-8?
clothes

  item Code=e1021
codee1021/code
image![CDATA[img src=uploads/image1.jpg alt=Homepage  
Image width=124 height=70 border=1  
onclick=MM_openBrWindow('uploads/ 
image1.jpg','Preview','width=680,height=520') /]]/image

nameRed Jacket/name
descAn adult sized red jacket/desc
sizeadult/size
price12.99/price
  /item

  item Code=e1022
codee1022/code
image![CDATA[img src=uploads/image2.jpg alt=Homepage  
Image width=124 height=70 border=1  
onclick=MM_openBrWindow('uploads/ 
image2.jpg','Preview','width=680,height=520') /]]/image

nameBlue Ski Trousers/name
descA pair of Blue Ski Trousers/desc
sizechild/size
price8.99/price
  /item

/clothes



Now the image tags I have written here I have done manually, but when  
I use PHP using DOM they come out like this (note the image element):


item Code=e1024
codee1024/code
imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage  
Image width=124 height=70 border=1  
onclick=MM_openBrWindow('uploads/ 
image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image

nameorange top/name
descan orange jacket/desc
sizelarge/size
price14.50/price
/item




Matthew Croud
Studio

Obvious Print Solutions Limited
Unit 3 Abbeygate Court
Stockett Lane
Maidstone
Kent
ME15 0PP

T | 0845 094 9704
F | 0845 094 9705
www.obviousprint.com







Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Ashley Sheridan
On Wed, 2009-09-09 at 14:46 +0100, Matthew Croud wrote:
 On 9 Sep 2009, at 14:36, Bob McConnell wrote:
 
  From: Bastien Koert
  On Wed, Sep 9, 2009 at 5:27 AM, Matthew  
  Croudm...@obviousdigital.com wrote:
 
  Hiya,
  I'm writing an app that let's my client upload images, the image  
  html code
  is added to an XML file.
  Take a look at the image element below:
 
  item Code=e1022
 codee1022/code
 image![CDATA[img src=uploads/image2.jpg alt=Homepage  
  Image
  width=124 height=70 /]]/image
 nameBlue Ski Trousers/name
 price8.99/price
   /item
 
  Now, whenever PHP writes this to the XML files, it turns the  and  
   into
  lt; and gt; . which means it does not display on the webpage.   
  How can I
  prevent this from happening ?
 
 
  str_replace?
 
 
  Does the xml string get passed to htmlentities() or a similar  
  function before it is sent to the browser? That would explain the  
  substitutions. I saw an xmlentities() variation mentioned somewhere.
 
  Bob McConnell
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Hi Bob,
 
 Nope the string doesn't get passed into any function.
 Here is the XML:
 _
 
 ?xml version=1.0 encoding=UTF-8?
 clothes
 
item Code=e1021
  codee1021/code
  image![CDATA[img src=uploads/image1.jpg alt=Homepage  
 Image width=124 height=70 border=1  
 onclick=MM_openBrWindow('uploads/ 
 image1.jpg','Preview','width=680,height=520') /]]/image
  nameRed Jacket/name
  descAn adult sized red jacket/desc
  sizeadult/size
  price12.99/price
/item
 
item Code=e1022
  codee1022/code
  image![CDATA[img src=uploads/image2.jpg alt=Homepage  
 Image width=124 height=70 border=1  
 onclick=MM_openBrWindow('uploads/ 
 image2.jpg','Preview','width=680,height=520') /]]/image
  nameBlue Ski Trousers/name
  descA pair of Blue Ski Trousers/desc
  sizechild/size
  price8.99/price
/item
 
 /clothes
 
 
 
 Now the image tags I have written here I have done manually, but when  
 I use PHP using DOM they come out like this (note the image element):
 
 item Code=e1024
 codee1024/code
 imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage  
 Image width=124 height=70 border=1  
 onclick=MM_openBrWindow('uploads/ 
 image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image
 nameorange top/name
 descan orange jacket/desc
 sizelarge/size
 price14.50/price
 /item
 
 
 
 
 Matthew Croud
 Studio
 
 Obvious Print Solutions Limited
 Unit 3 Abbeygate Court
 Stockett Lane
 Maidstone
 Kent
 ME15 0PP
 
 T | 0845 094 9704
 F | 0845 094 9705
 www.obviousprint.com
 
 
 
 
 
I've not experienced this with using any DOM functions, but if we can
see your code it might help us.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Matthew Croud


On 9 Sep 2009, at 16:37, Ashley Sheridan wrote:


On Wed, 2009-09-09 at 15:14 +0100, Matthew Croud wrote:

On 9 Sep 2009, at 15:09, Ashley Sheridan wrote:


On Wed, 2009-09-09 at 14:46 +0100, Matthew Croud wrote:

On 9 Sep 2009, at 14:36, Bob McConnell wrote:


From: Bastien Koert

On Wed, Sep 9, 2009 at 5:27 AM, Matthew
Croudm...@obviousdigital.com wrote:


Hiya,
I'm writing an app that let's my client upload images, the image
html code
is added to an XML file.
Take a look at the image element below:

item Code=e1022
 codee1022/code
 image![CDATA[img src=uploads/image2.jpg alt=Homepage
Image
width=124 height=70 /]]/image
 nameBlue Ski Trousers/name
 price8.99/price
/item

Now, whenever PHP writes this to the XML files, it turns the   
and

into

lt; and gt; . which means it does not display on the webpage.
How can I
prevent this from happening ?



str_replace?



Does the xml string get passed to htmlentities() or a similar
function before it is sent to the browser? That would explain the
substitutions. I saw an xmlentities() variation mentioned  
somewhere.


Bob McConnell

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




Hi Bob,

Nope the string doesn't get passed into any function.
Here is the XML:
_

?xml version=1.0 encoding=UTF-8?
clothes

 item Code=e1021
   codee1021/code
   image![CDATA[img src=uploads/image1.jpg alt=Homepage
Image width=124 height=70 border=1
onclick=MM_openBrWindow('uploads/
image1.jpg','Preview','width=680,height=520') /]]/image
   nameRed Jacket/name
   descAn adult sized red jacket/desc
   sizeadult/size
   price12.99/price
 /item

 item Code=e1022
   codee1022/code
   image![CDATA[img src=uploads/image2.jpg alt=Homepage
Image width=124 height=70 border=1
onclick=MM_openBrWindow('uploads/
image2.jpg','Preview','width=680,height=520') /]]/image
   nameBlue Ski Trousers/name
   descA pair of Blue Ski Trousers/desc
   sizechild/size
   price8.99/price
 /item

/clothes



Now the image tags I have written here I have done manually, but  
when
I use PHP using DOM they come out like this (note the image  
element):


item Code=e1024
codee1024/code
imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage
Image width=124 height=70 border=1
onclick=MM_openBrWindow('uploads/
image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image
nameorange top/name
descan orange jacket/desc
sizelarge/size
price14.50/price
/item




Matthew Croud
Studio

Obvious Print Solutions Limited
Unit 3 Abbeygate Court
Stockett Lane
Maidstone
Kent
ME15 0PP

T | 0845 094 9704
F | 0845 094 9705
www.obviousprint.com





I've not experienced this with using any DOM functions, but if we  
can

see your code it might help us.

Thanks,
Ash
http://www.ashleysheridan.co.uk




--  
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php






Well i'll pop the PHP down here, i'll trim it as much as i can:


$code = $_POST['code'];
$name = $_POST['name'];
$desc = $_POST['desc'];
$size = $_POST['size'];
$price = $_POST['price'];


#load an XML document into the DOM

$dom = new DomDocument();
$dom - load(items.xml);

#create elements

$Xitem =  $dom - createElement(item);
$Xcode =  $dom - createElement(code);
$Ximage =  $dom - createElement(image);
$Xname =  $dom - createElement(name);
$Xdesc = $dom - createElement(desc);
$Xsize = $dom - createElement(size);
$Xprice = $dom - createElement(price);

#create text nodes

$Xcodetext =  $dom - createTextNode($code);
$Ximagetext =  $dom - createTextNode( ![CDATA[img src=\uploads/
$UploadName\ alt=\Homepage Image\ width=\124\ height=\70\
border=\1\ onclick=\MM_openBrWindow('uploads/
$UploadName','Preview','width=680,height=520')\ /]] );
$Xnametext =  $dom - createTextNode($name);
$Xdesctext = $dom - createTextNode($desc);
$Xsizetext =$dom - createTextNode($size);
$Xpricetext =$dom - createTextNode($price);

#append the text nodes to the inner nested elements

$Xcode  - appendChild($Xcodetext);
$Ximage  - appendChild($Ximagetext);
$Xname  - appendChild($Xnametext);
$Xdesc - appendChild($Xdesctext);
$Xsize- appendChild($Xsizetext);
$Xprice- appendChild($Xpricetext);

#append the inner nested elements to the item element

$Xitem - appendChild($Xcode);
$Xitem - appendChild($Ximage);
$Xitem - appendChild($Xname);
$Xitem - appendChild($Xdesc);
$Xitem - appendChild($Xsize);
$Xitem - appendChild($Xprice);
$Xitem - setAttribute(Code,$code);

#append the title element to the root element

$dom - documentElement - appendChild($Xitem);

#create a new enlarged xml document

$dom - save(items.xml);

_
It looks like it's because you are creating an image object by  
appending

a text node inside CDATA to it. My guess is 

Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Ashley Sheridan
On Wed, 2009-09-09 at 16:51 +0100, Matthew Croud wrote:
 On 9 Sep 2009, at 16:37, Ashley Sheridan wrote:
 
  On Wed, 2009-09-09 at 15:14 +0100, Matthew Croud wrote:
  On 9 Sep 2009, at 15:09, Ashley Sheridan wrote:
 
  On Wed, 2009-09-09 at 14:46 +0100, Matthew Croud wrote:
  On 9 Sep 2009, at 14:36, Bob McConnell wrote:
 
  From: Bastien Koert
  On Wed, Sep 9, 2009 at 5:27 AM, Matthew
  Croudm...@obviousdigital.com wrote:
 
  Hiya,
  I'm writing an app that let's my client upload images, the image
  html code
  is added to an XML file.
  Take a look at the image element below:
 
  item Code=e1022
   codee1022/code
   image![CDATA[img src=uploads/image2.jpg alt=Homepage
  Image
  width=124 height=70 /]]/image
   nameBlue Ski Trousers/name
   price8.99/price
  /item
 
  Now, whenever PHP writes this to the XML files, it turns the   
  and
  into
  lt; and gt; . which means it does not display on the webpage.
  How can I
  prevent this from happening ?
 
 
  str_replace?
 
 
  Does the xml string get passed to htmlentities() or a similar
  function before it is sent to the browser? That would explain the
  substitutions. I saw an xmlentities() variation mentioned  
  somewhere.
 
  Bob McConnell
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  Hi Bob,
 
  Nope the string doesn't get passed into any function.
  Here is the XML:
  _
 
  ?xml version=1.0 encoding=UTF-8?
  clothes
 
   item Code=e1021
 codee1021/code
 image![CDATA[img src=uploads/image1.jpg alt=Homepage
  Image width=124 height=70 border=1
  onclick=MM_openBrWindow('uploads/
  image1.jpg','Preview','width=680,height=520') /]]/image
 nameRed Jacket/name
 descAn adult sized red jacket/desc
 sizeadult/size
 price12.99/price
   /item
 
   item Code=e1022
 codee1022/code
 image![CDATA[img src=uploads/image2.jpg alt=Homepage
  Image width=124 height=70 border=1
  onclick=MM_openBrWindow('uploads/
  image2.jpg','Preview','width=680,height=520') /]]/image
 nameBlue Ski Trousers/name
 descA pair of Blue Ski Trousers/desc
 sizechild/size
 price8.99/price
   /item
 
  /clothes
 
  
 
  Now the image tags I have written here I have done manually, but  
  when
  I use PHP using DOM they come out like this (note the image  
  element):
 
  item Code=e1024
  codee1024/code
  imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage
  Image width=124 height=70 border=1
  onclick=MM_openBrWindow('uploads/
  image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image
  nameorange top/name
  descan orange jacket/desc
  sizelarge/size
  price14.50/price
  /item
 
 
 
 
  Matthew Croud
  Studio
 
  Obvious Print Solutions Limited
  Unit 3 Abbeygate Court
  Stockett Lane
  Maidstone
  Kent
  ME15 0PP
 
  T | 0845 094 9704
  F | 0845 094 9705
  www.obviousprint.com
 
 
 
 
 
  I've not experienced this with using any DOM functions, but if we  
  can
  see your code it might help us.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 
  --  
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
  Well i'll pop the PHP down here, i'll trim it as much as i can:
  
 
  $code = $_POST['code'];
  $name = $_POST['name'];
  $desc = $_POST['desc'];
  $size = $_POST['size'];
  $price = $_POST['price'];
 
 
  #load an XML document into the DOM
 
  $dom = new DomDocument();
  $dom - load(items.xml);
 
  #create elements
 
  $Xitem =  $dom - createElement(item);
  $Xcode =  $dom - createElement(code);
  $Ximage =  $dom - createElement(image);
  $Xname =  $dom - createElement(name);
  $Xdesc = $dom - createElement(desc);
  $Xsize = $dom - createElement(size);
  $Xprice = $dom - createElement(price);
 
  #create text nodes
 
  $Xcodetext =  $dom - createTextNode($code);
  $Ximagetext =  $dom - createTextNode( ![CDATA[img src=\uploads/
  $UploadName\ alt=\Homepage Image\ width=\124\ height=\70\
  border=\1\ onclick=\MM_openBrWindow('uploads/
  $UploadName','Preview','width=680,height=520')\ /]] );
  $Xnametext =  $dom - createTextNode($name);
  $Xdesctext = $dom - createTextNode($desc);
  $Xsizetext =$dom - createTextNode($size);
  $Xpricetext =$dom - createTextNode($price);
 
  #append the text nodes to the inner nested elements
 
  $Xcode  - appendChild($Xcodetext);
  $Ximage  - appendChild($Ximagetext);
  $Xname  - appendChild($Xnametext);
  $Xdesc - appendChild($Xdesctext);
  $Xsize- appendChild($Xsizetext);
  $Xprice- appendChild($Xpricetext);
 
  #append the inner nested elements to the item element
 
  $Xitem - appendChild($Xcode);
  $Xitem - appendChild($Ximage);
  $Xitem - appendChild($Xname);
  $Xitem - appendChild($Xdesc);
  $Xitem - appendChild($Xsize);
  $Xitem - 

Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Tony Marston
You need to look at disable_output_escaping at 
http://www.w3.org/TR/xslt#disable-output-escaping

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

Matthew Croud m...@obviousdigital.com wrote in message 
news:2c4840c2-45db-4d6c-b5fa-2cb15b171...@obviousdigital.com...

 On 9 Sep 2009, at 14:26, Bastien Koert wrote:

 On Wed, Sep 9, 2009 at 5:27 AM, Matthew  Croudm...@obviousdigital.com 
 wrote:

 Hiya,
 I'm writing an app that let's my client upload images, the image  html 
 code
 is added to an XML file.
 Take a look at the image element below:

 item Code=e1022
codee1022/code
image![CDATA[img src=uploads/image2.jpg alt=Homepage Image
 width=124 height=70 /]]/image
nameBlue Ski Trousers/name
price8.99/price
  /item

 Now, whenever PHP writes this to the XML files, it turns the  and
  into
 lt; and gt; . which means it does not display on the webpage.   How 
 can I
 prevent this from happening ?

 Many thanks,
 Matt


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



 str_replace?


 -- 

 Bastien

 Cat, the other other white meat


 I've tried that but no matter what i do in the PHP side of things, as 
 soon as I save that XML the conversion takes place.
 Should the XML be encoded in any way, is there a setting somewhere  that 
 prevents this ? 



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



Re: [PHP] XML. Prevent from turning into lt;

2009-09-09 Thread Ralph Deffke
give it a try with PDATA instead of CDATA and see what happns


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1252512252.2961.40.ca...@localhost...
 On Wed, 2009-09-09 at 16:51 +0100, Matthew Croud wrote:
  On 9 Sep 2009, at 16:37, Ashley Sheridan wrote:
 
   On Wed, 2009-09-09 at 15:14 +0100, Matthew Croud wrote:
   On 9 Sep 2009, at 15:09, Ashley Sheridan wrote:
  
   On Wed, 2009-09-09 at 14:46 +0100, Matthew Croud wrote:
   On 9 Sep 2009, at 14:36, Bob McConnell wrote:
  
   From: Bastien Koert
   On Wed, Sep 9, 2009 at 5:27 AM, Matthew
   Croudm...@obviousdigital.com wrote:
  
   Hiya,
   I'm writing an app that let's my client upload images, the image
   html code
   is added to an XML file.
   Take a look at the image element below:
  
   item Code=e1022
codee1022/code
image![CDATA[img src=uploads/image2.jpg alt=Homepage
   Image
   width=124 height=70 /]]/image
nameBlue Ski Trousers/name
price8.99/price
   /item
  
   Now, whenever PHP writes this to the XML files, it turns the 
   and
   into
   lt; and gt; . which means it does not display on the webpage.
   How can I
   prevent this from happening ?
  
  
   str_replace?
  
  
   Does the xml string get passed to htmlentities() or a similar
   function before it is sent to the browser? That would explain the
   substitutions. I saw an xmlentities() variation mentioned
   somewhere.
  
   Bob McConnell
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
   Hi Bob,
  
   Nope the string doesn't get passed into any function.
   Here is the XML:
   _
  
   ?xml version=1.0 encoding=UTF-8?
   clothes
  
item Code=e1021
  codee1021/code
  image![CDATA[img src=uploads/image1.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image1.jpg','Preview','width=680,height=520') /]]/image
  nameRed Jacket/name
  descAn adult sized red jacket/desc
  sizeadult/size
  price12.99/price
/item
  
item Code=e1022
  codee1022/code
  image![CDATA[img src=uploads/image2.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image2.jpg','Preview','width=680,height=520') /]]/image
  nameBlue Ski Trousers/name
  descA pair of Blue Ski Trousers/desc
  sizechild/size
  price8.99/price
/item
  
   /clothes
  
   
  
   Now the image tags I have written here I have done manually, but
   when
   I use PHP using DOM they come out like this (note the image
   element):
  
   item Code=e1024
   codee1024/code
   imagelt;![CDATA[lt;img src=uploads/image4.jpg alt=Homepage
   Image width=124 height=70 border=1
   onclick=MM_openBrWindow('uploads/
   image4.jpg','Preview','width=680,height=520') /gt;]]gt;/image
   nameorange top/name
   descan orange jacket/desc
   sizelarge/size
   price14.50/price
   /item
  
  
  
  
   Matthew Croud
   Studio
  
   Obvious Print Solutions Limited
   Unit 3 Abbeygate Court
   Stockett Lane
   Maidstone
   Kent
   ME15 0PP
  
   T | 0845 094 9704
   F | 0845 094 9705
   www.obviousprint.com
  
  
  
  
  
   I've not experienced this with using any DOM functions, but if we
   can
   see your code it might help us.
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
  
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
  
   Well i'll pop the PHP down here, i'll trim it as much as i can:
  

  
   $code = $_POST['code'];
   $name = $_POST['name'];
   $desc = $_POST['desc'];
   $size = $_POST['size'];
   $price = $_POST['price'];
  
  
   #load an XML document into the DOM
  
   $dom = new DomDocument();
   $dom - load(items.xml);
  
   #create elements
  
   $Xitem =  $dom - createElement(item);
   $Xcode =  $dom - createElement(code);
   $Ximage =  $dom - createElement(image);
   $Xname =  $dom - createElement(name);
   $Xdesc = $dom - createElement(desc);
   $Xsize = $dom - createElement(size);
   $Xprice = $dom - createElement(price);
  
   #create text nodes
  
   $Xcodetext =  $dom - createTextNode($code);
   $Ximagetext =  $dom - createTextNode( ![CDATA[img src=\uploads/
   $UploadName\ alt=\Homepage Image\ width=\124\ height=\70\
   border=\1\ onclick=\MM_openBrWindow('uploads/
   $UploadName','Preview','width=680,height=520')\ /]] );
   $Xnametext =  $dom - createTextNode($name);
   $Xdesctext = $dom - createTextNode($desc);
   $Xsizetext =$dom - createTextNode($size);
   $Xpricetext =$dom - createTextNode($price);
  
   #append the text nodes to the inner nested elements
  
   $Xcode  - appendChild($Xcodetext);
   $Ximage  - appendChild($Ximagetext);
   $Xname  - appendChild($Xnametext);
   $Xdesc - 

Re: [PHP] XML data extraction

2009-04-02 Thread Peter Ford
Andrew Williams wrote:
 Best All,
 
 How can you best and accurately extract  XLM data to DB table.  e.g.:
 
 EXCHANGE_LIST  AMOUNT=3
 -
 EXCHANGE
 ID_EXCHANGE20/ID_EXCHANGE
 CODE_EXCHANGEFRA/CODE_EXCHANGE
 NAME_EXCHANGEFrankfurt/NAME_EXCHANGE
 /EXCHANGE
 -
 EXCHANGE
 ID_EXCHANGE28/ID_EXCHANGE
 CODE_EXCHANGELSE/CODE_EXCHANGE
 NAME_EXCHANGELondon Stock Exchange/NAME_EXCHANGE
 /EXCHANGE
 -
 EXCHANGE
 ID_EXCHANGE226/ID_EXCHANGE
 CODE_EXCHANGEGER/CODE_EXCHANGE
 NAME_EXCHANGEXetra/NAME_EXCHANGE
 /EXCHANGE
 /EXCHANGE_LIST
 
 www.willandy.co.uk
 

Oh, I thought of another one:
Write some XSL to turn you XML into SQL.
Write some code to run that SQL.

HTH
Pete

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



[PHP] XML data extraction

2009-04-02 Thread Andrew Williams
Best All,

How can you best and accurately extract  XLM data to DB table.  e.g.:

EXCHANGE_LIST  AMOUNT=3
-
EXCHANGE
ID_EXCHANGE20/ID_EXCHANGE
CODE_EXCHANGEFRA/CODE_EXCHANGE
NAME_EXCHANGEFrankfurt/NAME_EXCHANGE
/EXCHANGE
-
EXCHANGE
ID_EXCHANGE28/ID_EXCHANGE
CODE_EXCHANGELSE/CODE_EXCHANGE
NAME_EXCHANGELondon Stock Exchange/NAME_EXCHANGE
/EXCHANGE
-
EXCHANGE
ID_EXCHANGE226/ID_EXCHANGE
CODE_EXCHANGEGER/CODE_EXCHANGE
NAME_EXCHANGEXetra/NAME_EXCHANGE
/EXCHANGE
/EXCHANGE_LIST

www.willandy.co.uk


Re: [PHP] XML data extraction

2009-04-02 Thread Peter Ford
Andrew Williams wrote:
 Best All,
 
 How can you best and accurately extract  XLM data to DB table.  e.g.:
 
 EXCHANGE_LIST  AMOUNT=3
 -
 EXCHANGE
 ID_EXCHANGE20/ID_EXCHANGE
 CODE_EXCHANGEFRA/CODE_EXCHANGE
 NAME_EXCHANGEFrankfurt/NAME_EXCHANGE
 /EXCHANGE
 -
 EXCHANGE
 ID_EXCHANGE28/ID_EXCHANGE
 CODE_EXCHANGELSE/CODE_EXCHANGE
 NAME_EXCHANGELondon Stock Exchange/NAME_EXCHANGE
 /EXCHANGE
 -
 EXCHANGE
 ID_EXCHANGE226/ID_EXCHANGE
 CODE_EXCHANGEGER/CODE_EXCHANGE
 NAME_EXCHANGEXetra/NAME_EXCHANGE
 /EXCHANGE
 /EXCHANGE_LIST
 
 www.willandy.co.uk
 

Write some code to read the XML file. (you could at simpleXML, or
DOMDocument-based stuff)
Write some code to write the database statements. (probably some SQL, depends on
your database)
Run the database statements. (mysql_query, pg_query, whatever)

This is a very vague question, and this list is not normally well disposed to
writing people's programs for them, especially when they look like college
assignments.

Cheers
Pete

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] XML data extraction

2009-04-02 Thread Per Jessen
Andrew Williams wrote:

 Best All,
 
 How can you best and accurately extract  XLM data to DB table.  e.g.:
 

Use XSLT to generate SQL INSERT statements.


/Per

-- 
Per Jessen, Zürich (11.3°C)


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



Re: [PHP] XML data extraction

2009-04-02 Thread Igor Escobar
@Jessen I read your answer and... You have any article speaking about that
you are saying?

Regards,
Igor Escobar
systems analyst  interface designer
www . igorescobar . com



On Thu, Apr 2, 2009 at 8:38 AM, Per Jessen p...@computer.org wrote:

 Andrew Williams wrote:

  Best All,
 
  How can you best and accurately extract  XLM data to DB table.  e.g.:
 

 Use XSLT to generate SQL INSERT statements.


 /Per

 --
 Per Jessen, Zürich (11.3°C)


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




Re: [PHP] XML data extraction

2009-04-02 Thread Per Jessen
Igor Escobar wrote:

 @Jessen I read your answer and... You have any article speaking about
 that you are saying?
 

Hi Igor

I don't have anything handy, but there's plenty of good material on the
internet about XSLT.  The main point is - XSLT is just reformatting the
data from XML format to a text format suitable for use as insert SQL
insert statements.  All you need to do is write the stylesheet that
takes format1 and converts it to format2. 
If you've not dealt with XSL before it can be a little daunting, but I
think you'll get the idea fairly quickly. 


/Per

-- 
Per Jessen, Zürich (14.3°C)


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



[PHP] XML manipulation

2009-03-03 Thread Raido

Hi!

Manipulating XML files with PHP is quite new thing to me, so I could 
need a bit help with it.

Here are the questions(and below are XML schema):
1) Is it possible to change those blocks order?
For example I move block number=1.1.1 below 1.1.3 and it's number 
gets changed from 1.1.1  1.1.3 and  1.1.2  1.1.1 and 1.1.3  1.1.2
I also should be able to change order of blocks with number=1.1 (for 
example 1.1  1.8 and 1.8  1.1)  and number=1.


2) where and how should I approach?
Theoretically I think I should make a html list from the blocks and make 
it sortable with help of jQuery... beginning doesn't seem so 
difficult..but what happends then? (SimpleXML havent helped me with 
changing order..it helps me to change and read attributes.)



So any suggestions/ideas for completing that kind of solution are welcome.


And here is the XML (simplified)structure:

--
block number=1 text=main of the all blocks
   block number=1.1
   block number=1.1.1
   somestuff_here text=hello/somestuff_here
   /block
   block number=1.1.2
   someotherstuff_here text=hello again/someotherstuff_here
   /block
   block number=1.1.3
   
   /block
   /block
   block number=1.2
   
   /block
/block

--



Thank you for help.

Raido

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



[PHP] XML and :

2009-02-24 Thread Merlin Morgenstern

Hi there,

I am trying to pars an XML file with php. This works if the xml tag 
looks like this: anbieternr88/anbieternr

In that case I retrieve the info: $xml-anbieternr

But now the tag looks different like this: 
imo:anbieternr88/imo:anbieternr


The command $xml-imo:anbieternr does not work in that case.

Has somebody an idea how to adress this?

Thank you for any help!

Merlin

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



Re: [PHP] XML and :

2009-02-24 Thread Andrew Ballard
On Tue, Feb 24, 2009 at 9:51 AM, Merlin Morgenstern
merli...@fastmail.fm wrote:
 Hi there,

 I am trying to pars an XML file with php. This works if the xml tag looks
 like this: anbieternr88/anbieternr
 In that case I retrieve the info: $xml-anbieternr

 But now the tag looks different like this:
 imo:anbieternr88/imo:anbieternr

 The command $xml-imo:anbieternr does not work in that case.

 Has somebody an idea how to adress this?

 Thank you for any help!

 Merlin


Short answer? You probably need to look at using XPath queries in
SimpleXML to get to those elements. Shorter answer? If you have to
deal with namespaces in documents, it's probably time for the project
to graduate from SimpleXML to something like DOM.

Look at the user note on this page:
http://us3.php.net/manual/en/intro.simplexml.php

Andrew

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



Re: [PHP] XML and :

2009-02-24 Thread mike
On Tue, Feb 24, 2009 at 6:51 AM, Merlin Morgenstern
merli...@fastmail.fm wrote:

 The command $xml-imo:anbieternr does not work in that case.

 Has somebody an idea how to adress this?

you could cheat and string replace the node prefix in the document

imo: to imo_ and then you can use simplexml. it's an ugly hack but it
can work :P

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



Re: [PHP] XML and :

2009-02-24 Thread Per Jessen
Merlin Morgenstern wrote:

 Hi there,
 
 I am trying to pars an XML file with php. This works if the xml tag
 looks like this: anbieternr88/anbieternr
 In that case I retrieve the info: $xml-anbieternr
 
 But now the tag looks different like this:
 imo:anbieternr88/imo:anbieternr
 
 The command $xml-imo:anbieternr does not work in that case.
 
 Has somebody an idea how to adress this?

When used like that 'imo' becomes a name-space. I don't know what sort
of parsing you're doing, but typically you would need to set that
first.



-- 
Per Jessen, Zürich (-1.5°C)


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



[PHP] XML - XSLT transformation using XSLTProcessor class

2009-02-20 Thread German Geek
Hi All,

We are trying to import some xml data into the database. My idea was to make
an xslt and then transform the xml to php code which generates the queries
necessary and then gets evaled as php code for the actual import...

Anyway, i got it working (mostly)!

But i need to get the current element name with x-path. So i have the
following:

rootEl
  elementAchildOfAsome data 1/childOfA/elementA
  elementBchildOfBsome data 2/childOfB/elementB
  elementBchildOfBsome data 3/childOfB/elementB
  elementAchildOfAsome data 4/childOfA/elementA
  elementAchildOfAsome data 5/childOfA/elementA
/rootEl

xsl:for-each select=//elementA | //elementB
  // xsl:value-of select=childOfA / WORKS and gives the value of
childOfA (e.g. some data 1)
  //... the php code...
/xsl:for-each

In the php code, I need to get the element tag name of the current element,
so either elementA or elementB. How can i get that in an x-path expression?

I know, this is not strictly a php question, but since the project is in php
and this list has a very good response rate, i decided to ask here. I
already looked on the web for hours, but maybe i just don't have the right
keywords.

Please help. Thanks.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
P. J. O'Rourke  - Everybody knows how to raise children, except the people
who have them.


RE: [PHP] XML - XSLT transformation using XSLTProcessor class

2009-02-20 Thread Boyd, Todd M.
 -Original Message-
 From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of
 German Geek
 Sent: Friday, February 20, 2009 9:18 AM
 To: PHP General list
 Subject: [PHP] XML - XSLT transformation using XSLTProcessor class
 
 Hi All,
 
 We are trying to import some xml data into the database. My idea was to
 make
 an xslt and then transform the xml to php code which generates the
 queries
 necessary and then gets evaled as php code for the actual import...
 
 Anyway, i got it working (mostly)!
 
 But i need to get the current element name with x-path. So i have the
 following:
 
 rootEl
   elementAchildOfAsome data 1/childOfA/elementA
   elementBchildOfBsome data 2/childOfB/elementB
   elementBchildOfBsome data 3/childOfB/elementB
   elementAchildOfAsome data 4/childOfA/elementA
   elementAchildOfAsome data 5/childOfA/elementA
 /rootEl
 
 xsl:for-each select=//elementA | //elementB
   // xsl:value-of select=childOfA / WORKS and gives the value of
 childOfA (e.g. some data 1)
   //... the php code...
 /xsl:for-each
 
 In the php code, I need to get the element tag name of the current
 element,
 so either elementA or elementB. How can i get that in an x-path
 expression?
 
 I know, this is not strictly a php question, but since the project is
 in php
 and this list has a very good response rate, i decided to ask here. I
 already looked on the web for hours, but maybe i just don't have the
 right
 keywords.
 
 Please help. Thanks.

I believe the name() XPath function is what you are looking for. It's been a 
while since I've worked with XPath query strings, but I believe .[name()] 
will get you the current element's tag name. Keep in mind: I'm not sure if this 
works with namespaced tags (like namespace:tagname /), but I have not tested 
this to be sure.

HTH,


// Todd


Re: [PHP] XML - XSLT transformation using XSLTProcessor class

2009-02-20 Thread German Geek
Thanks a lot. Sorry but 5 minutes after sending this email i figured it out
myself. I didn't know how to answer my own message because i didn't get my
own message... Anyway, this worked for me:

xsl:for-each select=//elementA | //elementB
  xsl:value-of select=name(.) /
/xsl:for-each

Hope this helps someone else...

Thanks again.

Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Bill Watterson  - There is not enough time to do all the nothing we want to
do.

2009/2/21 Boyd, Todd M. tmbo...@ccis.edu

  -Original Message-
  From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of
  German Geek
  Sent: Friday, February 20, 2009 9:18 AM
  To: PHP General list
  Subject: [PHP] XML - XSLT transformation using XSLTProcessor class
 
  Hi All,
 
  We are trying to import some xml data into the database. My idea was to
  make
  an xslt and then transform the xml to php code which generates the
  queries
  necessary and then gets evaled as php code for the actual import...
 
  Anyway, i got it working (mostly)!
 
  But i need to get the current element name with x-path. So i have the
  following:
 
  rootEl
elementAchildOfAsome data 1/childOfA/elementA
elementBchildOfBsome data 2/childOfB/elementB
elementBchildOfBsome data 3/childOfB/elementB
elementAchildOfAsome data 4/childOfA/elementA
elementAchildOfAsome data 5/childOfA/elementA
  /rootEl
 
  xsl:for-each select=//elementA | //elementB
// xsl:value-of select=childOfA / WORKS and gives the value of
  childOfA (e.g. some data 1)
//... the php code...
  /xsl:for-each
 
  In the php code, I need to get the element tag name of the current
  element,
  so either elementA or elementB. How can i get that in an x-path
  expression?
 
  I know, this is not strictly a php question, but since the project is
  in php
  and this list has a very good response rate, i decided to ask here. I
  already looked on the web for hours, but maybe i just don't have the
  right
  keywords.
 
  Please help. Thanks.

 I believe the name() XPath function is what you are looking for. It's been
 a while since I've worked with XPath query strings, but I believe
 .[name()] will get you the current element's tag name. Keep in mind: I'm
 not sure if this works with namespaced tags (like namespace:tagname /),
 but I have not tested this to be sure.

 HTH,


 // Todd



Re: [PHP] XML package on PHP

2009-01-07 Thread Jim Lucas
Merlin Morgenstern wrote:
 Hi there,
 
 I need pars an xml file with php 4. There seems to be a good package out
 there active link xml. However, last development was 2004. Is there
 something new around which you would recommend over active link?
 
 Thank you for any hints.
 
 Best regards,
 
 Merlin
 

Give this a shot

http://www.cmsws.com/examples/xml/xml2php/xml2php2xml-2005-09-09.tar.gz

if you go to

http://www.cmsws.com/examples/xml/xml2php/example.php

you can see an example of the output

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] XML package on PHP

2009-01-07 Thread Merlin Morgenstern

Hi there,

I need pars an xml file with php 4. There seems to be a good package out 
there active link xml. However, last development was 2004. Is there 
something new around which you would recommend over active link?


Thank you for any hints.

Best regards,

Merlin

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



Re: [PHP] XML package on PHP

2009-01-07 Thread ceo

XML in PHP4? Don't. :-)



It was very painful and with all kinds of quirks, from my limited experience.



PHP5 was a breeze.



Consider hosting a quick/easy service on a PHP5 box to convert XML to PHP 
serialized data or something as well.  Could be less painful.



Or just upgrade, since PHP4 has passed EOL.



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



Re: [PHP] XML package on PHP

2009-01-07 Thread Merlin Morgenstern

^THANX: Will upgrade to php5.

c...@l-i-e.com wrote:

XML in PHP4? Don't. :-)

It was very painful and with all kinds of quirks, from my limited experience.

PHP5 was a breeze.

Consider hosting a quick/easy service on a PHP5 box to convert XML to PHP 
serialized data or something as well.  Could be less painful.

Or just upgrade, since PHP4 has passed EOL.



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



Re: [PHP] XML Get Value of Node DOMXPath

2008-12-16 Thread Rob Richards

Stephen Alistoun wrote:

Hello all,

Need help to get the value of the node.

We know how to get the value of the city , item and itemPrice nodes below.

How do we get the value of NumberOfRooms?


$hotelElements = $xpath-query( '', $searchReponseElement );

foreach( $hotelElements as $hotelElement ) 
{


$city = $xpath-query( 'City' , $hotelElement );
$item = $xpath-query( 'Item' , $hotelElement );
$itemPrice = $xpath-query( 'ItemPrice' , $hotelElement );
$confirmation = $xpath-query( 'Confirmation' , $hotelElement );

}
Here is an example of the XML Response:

Hotel HasExtraInfo=true
  City Code=AMS![CDATA[ Amsterdam ]]/City
  Item Code=JAN![CDATA[ JAN LUYKEN HTL AND 
RESIDENCE]]/Item
  LocationDetails
  Location Code=G1![CDATA[ Central ]]/Location
  /LocationDetails
  StarRating4/StarRating
 HotelRooms
 HotelRoom 
   Code=SB 
   NumberOfRooms=1 /
 HotelRoom 
   Code=TB 
   ExtraBed=true 
   NumberCots=1 
   NumberOfExtraBeds=2   
   NumberOfRooms=1 
   SharingBedding=true / 
/HotelRooms


Thanks


You can do it in a number of ways.

$rooms = $xpath-query('/Hotel/HotelRooms/HotelRoom');

/* Via DOMElement */
foreach ($rooms AS $room) {
echo $room-getAttribute('NumberOfRooms') . \n\n;
}


/* Via XPath */
foreach ($rooms AS $room) {
   $numrooms = $xpath-evaluate('number(./@NumberOfRooms)', $room);
   echo $numrooms . \n\n;
}

Rob

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



[PHP] XML Get Value of Node DOMXPath

2008-12-15 Thread Stephen Alistoun

Hello all,

Need help to get the value of the node.

We know how to get the value of the city , item and itemPrice nodes below.

How do we get the value of NumberOfRooms?


$hotelElements = $xpath-query( '', $searchReponseElement );

foreach( $hotelElements as $hotelElement ) 
{

$city = $xpath-query( 'City' , $hotelElement );
$item = $xpath-query( 'Item' , $hotelElement );
$itemPrice = $xpath-query( 'ItemPrice' , $hotelElement );
$confirmation = $xpath-query( 'Confirmation' , $hotelElement );

}
Here is an example of the XML Response:

Hotel HasExtraInfo=true
  City Code=AMS![CDATA[ Amsterdam ]]/City
  Item Code=JAN![CDATA[ JAN LUYKEN HTL AND 
RESIDENCE]]/Item
  LocationDetails
  Location Code=G1![CDATA[ Central ]]/Location
  /LocationDetails
  StarRating4/StarRating
 HotelRooms
 HotelRoom 
   Code=SB 
   NumberOfRooms=1 /
 HotelRoom 
   Code=TB 
   ExtraBed=true 
   NumberCots=1 
   NumberOfExtraBeds=2   
   NumberOfRooms=1 
   SharingBedding=true / 

/HotelRooms

Thanks
-- 
View this message in context: 
http://www.nabble.com/XML-Get-Value-of-Node-DOMXPath-tp21015877p21015877.html
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] XML RSS installation

2008-12-02 Thread ceo

 htdocs -- This the document root of your website pear  + HTML  + Mail

 + Net



If you're going to set your include path properly, you might as well not put 
PEAR in htdocs, since none of those files are front-facing URLs that should be 
visited by an end user.



They belong in a non web root directory somewhere else to insure that there 
is NO WAY EVER that they could be visited directly by a malicious user.

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



Re: [PHP] XML RSS installation

2008-12-02 Thread Richard Heyes
 What do you mean by replicating the directory structure?

PEAR has a directory structure. Duplicate it and set you include_path
accordingly. Have a look at the application structure on article my
website ( http://www.phpguru.org ) - it may be of some help.

Eg:

htdocs -- This the document root of your website
pear
 + HTML
 + Mail
 + Net

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



Re: [PHP] XML RSS installation

2008-12-02 Thread Richard Heyes
 htdocs -- This the document root of your website pear  + HTML  + Mail
 + Net

That's not what I wrote:

htdocs -- This the document root of your website
pear
 + HTML
 + Mail
 + Net

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



Re: [PHP] XML RSS installation

2008-12-02 Thread Richard Heyes
 I apologize for the misunderstanding.

That's OK, I forgive you my child. :-)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



Re: [PHP] XML RSS installation

2008-12-02 Thread ceo

 htdocs -- This the document root of your website pear  + HTML  + 

 Mail

 + Net



That's not what I wrote:



htdocs -- This the document root of your website pear  + HTML  + Mail

  + Net



I apologize for the misunderstanding.



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



[PHP] XML RSS installation

2008-12-01 Thread Joe Schoemann
I previously had my web page hosted on a shared Apache server. The web hosts
installed the PEAR modules on the system for me.

I have now decided to go to Godaddy who have a shared Linux server.

They do not install PEAR modules and I have to do myself.

I found the go-pear.php program and managed to get it to install PEAR, but
the XML_RSS was not included.

I scratched around further and found there is a file called
XML_RSS-0.9.10.tar which I have downloaded to my PC.

I can upload it to my web site with FTP but I don't know where to put it or
what to do with it.

I have been at this for 3 days now and need some help, what must I do now to
get the RSS working. 

 

Yours truly,

 

Joe



Re: [PHP] XML RSS installation

2008-12-01 Thread Richard Heyes
 ...

You might be interested to know that with PEAR there is absolutely no
need to use the installer at all. You may find it easier not to. For
example the file you mentioned (XML_RSS) is here:

http://cvs.php.net/viewvc.cgi/pear/XML_RSS/RSS.php?revision=1.28view=co

You will need to replicate the directory structure, but that's not
exactly a chore. This is the way I use PEAR components - I don't use
the PEAR installer at all. Personally I think this way is far more
convenient. The installer may make it easier when installing larger
packages which have a fair few files, but personally I'd still go with
this method.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



[PHP] XML Encoding

2008-07-29 Thread Thiago H. Pojda
Guys,

I'm building a XML in a PHP Script. Everything works fine until I add
accented (ISO-8859-1) characters into it.

As far as I can see, there's no way to change DOMDocument's encoding from
UTF-8, right?


Thanks,
-- 
Thiago Henrique Pojda


  1   2   3   4   5   6   7   8   9   >