Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Using PHP to parse specific XML tag content?

From: Jerry Stuckle <jstucklex@---------.--->
To: NULL
Date: 12/4/2008 4:35:00 PM
_Z_ wrote:
> Hi,
> 
> I have quite different approach. Since PHP is only the engine to
> produce HTML from XML data, then all processing of XML I do with XSLT.
> PHP is only a kind of manager (gets the name of XML file, sends
> content-type, selects proper xsl file). Here is the code:
>

Actually, PHP doesn't "produce HTML from XML data".  You can parse XML 
data and generate output from it in PHP - but so can you in many languages.

> <?php
> header() ;
> $xsl = "MyForm.xsl" ;
> $command = "xsltproc " . $xsl . " " . $_GET[XML_File] ;
> $last_line = system( $command ) ;
> ?>
> 
> Of course you have to have xsltproc installed, but I assume you have
> it. This way enables you to test your XML --> HTML transformation in
> testing environment. For example:
> bash# xsltproc MyForm.xsl TestData.xml
> 

Even more basic that that - you have to have permission to execute 
commands, which many shared hosts do not allow.  And you must, of 
course, be running on a Linux system.

> That is the end of the story if you want only to display the data from
> XML file.
> 

Only if you have those tools installed, and can stand the default format 
produced.  That often isn't true.  SimpleXML or the DOM functions give 
you much more control.

> If not, and you want HTML to be a FORM to post the data back to the
> server then you need to parse it in the PHP, but this part is easy
> isn't it?
> 
> Cheers
> 
> - Marcin
> 
> 

Yes, it can be quite easy.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@a...
==================


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent