Re: [PHP] Re: DOM XML and php
But of course you can. Check out the manual: http://ro.php.net/manual/en/function.domxml-open-mem.php and the code sample I've sent you in the thread, Regards, Lucian Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I agree but I cannot find a way to transform xlm data from variable not open xml file with using DOMXML. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 1:50 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php True, but it does much more than that. It also provides xslt transformations. It uses the powerfull libxslt library that provides far more features, speed and reliablility than Sablot. I would rather do XSL transformations with DOMXML than with Sablot just for these reasons. Thanks for your response. Lucian Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sory for delay I use sablotron because I take xml data via curl from windows server. I need only a way to transform xml data with xslt and I want to present data to web pages. I think DOMXML provide functions to create XML docs from the beginning and manipulate xml data like add or remove xml elements. I hope to help you. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 5:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php I have a question please (I'm trying to clarify something for me): Why do you preffer Sablotron to DOMXML ? As I'm developping XML/XSLT framework applications, I'm trying to understand why would our clients use it instead of DOMXML and adapt to it if there is a good reason for it. I want to know this because DOMXML is faster and more reliable than Sablotron (my opinion after using extesively both of them), and both are extensions, that you have to install, not something native that comes directly embeded into PHP. Thanks, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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] Re: DOM XML and php
Sory for delay I use sablotron because I take xml data via curl from windows server. I need only a way to transform xml data with xslt and I want to present data to web pages. I think DOMXML provide functions to create XML docs from the beginning and manipulate xml data like add or remove xml elements. I hope to help you. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 5:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php I have a question please (I'm trying to clarify something for me): Why do you preffer Sablotron to DOMXML ? As I'm developping XML/XSLT framework applications, I'm trying to understand why would our clients use it instead of DOMXML and adapt to it if there is a good reason for it. I want to know this because DOMXML is faster and more reliable than Sablotron (my opinion after using extesively both of them), and both are extensions, that you have to install, not something native that comes directly embeded into PHP. Thanks, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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 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] Re: DOM XML and php
True, but it does much more than that. It also provides xslt transformations. It uses the powerfull libxslt library that provides far more features, speed and reliablility than Sablot. I would rather do XSL transformations with DOMXML than with Sablot just for these reasons. Thanks for your response. Lucian Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sory for delay I use sablotron because I take xml data via curl from windows server. I need only a way to transform xml data with xslt and I want to present data to web pages. I think DOMXML provide functions to create XML docs from the beginning and manipulate xml data like add or remove xml elements. I hope to help you. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 5:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php I have a question please (I'm trying to clarify something for me): Why do you preffer Sablotron to DOMXML ? As I'm developping XML/XSLT framework applications, I'm trying to understand why would our clients use it instead of DOMXML and adapt to it if there is a good reason for it. I want to know this because DOMXML is faster and more reliable than Sablotron (my opinion after using extesively both of them), and both are extensions, that you have to install, not something native that comes directly embeded into PHP. Thanks, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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 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] Re: DOM XML and php
Hi, I agree but I cannot find a way to transform xlm data from variable not open xml file with using DOMXML. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 1:50 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php True, but it does much more than that. It also provides xslt transformations. It uses the powerfull libxslt library that provides far more features, speed and reliablility than Sablot. I would rather do XSL transformations with DOMXML than with Sablot just for these reasons. Thanks for your response. Lucian Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sory for delay I use sablotron because I take xml data via curl from windows server. I need only a way to transform xml data with xslt and I want to present data to web pages. I think DOMXML provide functions to create XML docs from the beginning and manipulate xml data like add or remove xml elements. I hope to help you. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 5:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php I have a question please (I'm trying to clarify something for me): Why do you preffer Sablotron to DOMXML ? As I'm developping XML/XSLT framework applications, I'm trying to understand why would our clients use it instead of DOMXML and adapt to it if there is a good reason for it. I want to know this because DOMXML is faster and more reliable than Sablotron (my opinion after using extesively both of them), and both are extensions, that you have to install, not something native that comes directly embeded into PHP. Thanks, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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 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 General Mailing
RE: [PHP] Re: DOM XML and php
Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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] Re: DOM XML and php
The problem you have is that you do not use DOMXML tranformations, you use Sablotron tranformations (xslt extension). DOMXML and XSLT are 2 different extensions (and you cannot mix each-others' objects, you must use the same objects of DOM or XSLT). You should use DOMXML's functions (are faster, more reliable, and they would work with the DOM object you create with the code I've posted): ?php $xslFile = 'myxsl.xsl'; $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$xml= domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } $xsl = domxml_xslt_stylesheet(file_get_contents($xslFile)); $domObj = $xsl-process($xml); echo $domObj-dump_mem(); ? The myxsl.xslt file: ?xml version=1.0? xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:template match=/ okxsl:value-of select=/bla/bla1//ok /xsl:template /xsl:stylesheet I think that should do it. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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] Re: DOM XML and php
If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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] Re: DOM XML and php
It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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] Re: DOM XML and php
Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DOM XML and php
I have a question please (I'm trying to clarify something for me): Why do you preffer Sablotron to DOMXML ? As I'm developping XML/XSLT framework applications, I'm trying to understand why would our clients use it instead of DOMXML and adapt to it if there is a good reason for it. I want to know this because DOMXML is faster and more reliable than Sablotron (my opinion after using extesively both of them), and both are extensions, that you have to install, not something native that comes directly embeded into PHP. Thanks, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks I use this code and it works. tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 4:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: DOM XML and php It should look something like (pretty much extracted from manual): ?php // $xml and $xsl contain the XML and XSL data ($xsl = file_get_contents('myxsl.xsl') and $xml ='blabla1lalala/bla1/bla $arguments = array( '/_xml' = $xml, '/_xsl' = $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { //SUCCESS, sample.xml was transformed by sample.xsl into the $result print $result; } else { print Sorry, sample.xml could not be transformed by sample.xsl into; print the \$result variable the reason is that . xslt_error($xh) . print and the error code is . xslt_errno($xh); } xslt_free($xh); ?Lucian COZMA Lucian Cozma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you really want to use Sablotron (although I tried it I not liked it as much as DOMXML, gimme a sign, and I'll debug you. Regards, Lucian COZMA @ InterAKT Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your reply but I have another problem I have an xml string if I use this code ? header(Content-Type: text/xml); echo $xml_string; ? I can see the xml tree but I cannot transform with te xslt. Eg. ? $xp = xslt_create(); $result_xsl = xslt_process($xp, $xml_string, 'myxsl.xsl'); echo $result_xsl; xslt_free($xp); ? Please advise Regards tassos -Original Message- From: Lucian COZMA [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: DOM XML and php ?php $xmlstr = 'blabla1blabalabalab/bla1/bla'; if(!$dom = domxml_open_mem($xmlstr)) { echo Error while parsing the document\n; exit; } // The root domdocument node $root = $dom-document_element(); ///Dump the content back to string var_dump($dom-dump_mem()); ? Read the manual in the DOM XML functions section. Regards, Lucian COZMA Tassos T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I face a problem. I have a php script and I send a xml request to a server. After I receive xml data but I have this data to an php string variable. How to create a xml dom with out to write a xml file ? I want to use a xslt to tranform that xml data. Any idea ? Thanks tassos -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php