[PHP] Re: DOM/XML Query
Andrew Clarke wrote: I'm having some problems using PHP5 on Windows 2000 Server, running IIS 5. When trying to access a document from a xmldoc() function the system responds with the following, *Fatal error*: Call to undefined function xmldoc() in *XML Document* on line *Number* ** How do I fix this problem? Is there a fix for this? Thanks for your help Install xml support for your PHP. PHP is telling you that such function is not included in your current PHP version. -Call to undefined function xmldoc() Translated: I don't have that function xmldoc() Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML issue
Andrew Kachalo wrote: Hi! ... Fatal error: Call to undefined function domxml_open_file() in /Users/Andrew/Sites/portfolio/index.php on line 61 This is because PHP5 now has an object-oriented approach. You use DOMDocument's and/or SimpleXML to read your XML files. Also in the newest versions of PHP there is a new extension called XMLWriter that might better suit your needs. How can I fix this problem? In short, you can't do anything except modify code to the new way of doing things. XML support is the lesser-known-yet-dramatic change in the migration from PHP 4 to PHP 5. http://php.net/manual/en/ref.dom.php Thank you! == Best Regards Andrew Kachalo http://www.geocities.com/andrew_kachalo/ -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML output whitespace
Martin Geisler wrote: I don't remember any more where I found this, but with ?php $dom = new DomDocument(); $dom-formatOutput = true; ? you get what you ask for: formatted output. Excellent, that did the trick! Thanks, -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML output whitespace
[EMAIL PROTECTED] (Dan Phiffer) writes: I'm using PHP 5 these days, so I guess I'm looking for some way to tell a DomDocument to prettify its save() output. I don't remember any more where I found this, but with ?php $dom = new DomDocument(); $dom-formatOutput = true; ? you get what you ask for: formatted output. -- Martin Geisler My GnuPG Key: 0xF7F6B57B PHP EXIF Library | PhpWeather | PhpShell http://pel.sf.net/| http://phpweather.net/ | http://gimpster.com/ Read/write EXIF data | Show current weather| A shell in a browser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
[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
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
[PHP] Re: DOM XML : experimental ?
I am planning to use PHP to develop some scripts that will need to create and manipulate html pages. One of the things that will be created is a DOM tree of the html. After reading the manual I've found that php supports the event-driven and dom xml, but with the latter tagged as EXPERIMENTAL. I've also noticed that as of 4.3.0-dev (which I am using) the api has changed. So I'd like to know how experimental (also stable) this support is and suggestions regarding this issue and DOM itself. One of the main issues is that I'll need to cope with html (not xml) and mostly not well-formed. Disclaimer: The following statements are based strictly on heresay: I don't think the DOM in PHP lets you have any hooks for mal-formed XML. It either is well-formed, or DOM pukes all over your pretty blue suede shoes. I think you may be better off writing a SAX parser-based XML algorithm. You'll be able to deal with the idiosyncracies of your HTML-coders better, and to recover with more flexibility from the errors. I think DOM will give you a line number and column (character within the line) number, and maybe even an XML error message. But you won't be able to convince it to just accept the HTML and move on with life as it is. You'll be forced to fix the HTML to match XML specs, which, like is just wrong, since HTML isn't XML. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML
I'm assuming it's that stray dollar sign you have in front of domxml_root. J Sebastian A. wrote: Hello, I have been recently doing experiments with the DOM XML function and I am (not surprisingly) having some problems with it. When I try to run the code below, I get an error saying I am trying to use and endefined function. To me it seems that the DOM XML extension is working fine, because I get no error from xmldoc(), but I am still not sure what the problem is. I am running PHP 4.2 Code: ?php $str = ?XML version=\1.0\?menameAnyname/name/me; $dom = xmldoc($str); $root = $domxml_root($dom); echo $root-name; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML?
In [EMAIL PROTECTED], Yasuo Ohgaki wrote: Daniele Baroncelli wrote: Hello, I would like to restyle one big site in XML and I would like some brief straight info/suggestions. I am definitely interested in DOM XML, but as far as I can understand, the module is still experimental and there to main risks: - The module is not completely stable - The functions are likely to change Are you able to confirm me these? I would agree that the DMO stuff isn't 100% stable but it is already functional enough to be usable. I have been using the DOM stuff in a production enviornment including the XPath functionality for a good four or five months now without major problems. The XSLT functionality is coming along nicely as well. I would suggest at least playing around with it to see if it fits your needs. I think you will find advantages to using it over the saxon-style stuff in the other XML PHP functions, especially if you utilize the XPath search functionality. Jeff You are right about this. But please use it and report bugs if you find one. The more users, it will be more stable quickly. Please also try latest snapshot for experimental modules/functions. http://snaps.php.net/ As an alternative, it seems the only safe way to develop XML in PHP is by using the Expat module. Is this your view too? I would say yes, but you may experience problem(s). In any case, are you able to indicate some good web references for XML in PHP ? I don't know this one ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: DOM XML?
Daniele Baroncelli wrote: Hello, I would like to restyle one big site in XML and I would like some brief straight info/suggestions. I am definitely interested in DOM XML, but as far as I can understand, the module is still experimental and there to main risks: - The module is not completely stable - The functions are likely to change Are you able to confirm me these? You are right about this. But please use it and report bugs if you find one. The more users, it will be more stable quickly. Please also try latest snapshot for experimental modules/functions. http://snaps.php.net/ As an alternative, it seems the only safe way to develop XML in PHP is by using the Expat module. Is this your view too? I would say yes, but you may experience problem(s). In any case, are you able to indicate some good web references for XML in PHP ? I don't know this one ;) -- Yasuo Ohgaki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]