You are here: RE: [PHP] PHP and XML « PHP « IT news, forums, messages
RE: [PHP] PHP and XML

Posted by "Robbert van Andel" on 11/30/78 11:28

Thanks, I'm investigating XSL and it looks pretty good. We use an RPM based
installation of PHP version 5.0.4. I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line. How do I do this when we did not build
PHP from source? Is there another way to get XSL activated?

Thanks for your help
Robbert

-----Original Message-----
From: Stephen Leaf [mailto:smileaf@smileaf.org]
Sent: Wednesday, October 05, 2005 7:39 PM
To: php-general@lists.php.net
Subject: Re: [PHP] PHP and XML

On Wednesday 05 October 2005 06:20 pm, php@swimwebs.com wrote:
> My company recently installed google's search appliance and I am working
> on some scripts to display the search results on our various websites.
> The problem I'm having is using the XML parsing functions I've used on
> other pages is not working because the returned XML has invalid xml
> characters in it. For example, the data between the xml tags include
> html tags that are supposed to be displayed. But when I parse the xml,
> the parse sees these tags as new start tags. Is there a way to work
> around this or a different way to parse this document? I've heard a
> little about XSLT really don't know anything about it and am wondering
> if that is the way to deal with it?
XSL can display the contents using a
<xsl:copy-of select="node"/>
bear in mind tho that it also copies the node name.
example:
<node>copied stuff<br/></node>

copying only the inner content can be achieved by doing a select="." however

you'll need to have the current node be the one that you want copied.
this can be done by using a
<xsl:for-each select="node">
<xsl:copy-of select="."/>
</xsl:for-each>

If anyone else knows of a better way _please_ let me know :)

When working with XML and going to HTML .. IMO XSL is the best way to
accomplish it.

>
> Here is a part of the XML returned by the google appliance:
> <GSP VER="3.2">
> <TM>0.008398</TM>
> <Q>information services</Q>
> <PARAM name="q" value="information services"
> original_value="information+services"/>
> <PARAM name="site" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="client" value="shpolicy" original_value="shpolicy"/>
> <PARAM name="output" value="xml_no_dtd" original_value="xml_no_dtd"/>
> <PARAM name="btnG" value="Google_Search"
> original_value="Google+Search"/>
> <PARAM name="ip" value="10.2.4.44" original_value="10.2.4.44"/>
> <PARAM name="access" value="p" original_value="p"/>
> -
> <RES SN="1" EN="10">
> <M>86</M>
> <FI/>
> -
> <NB>
> -
> <NU>
>
/search?q=information+services&site=shpolicy&hl=en&output=xml_no_dtd&client
>=shpolicy&access=p&sort=date:D:L:d1&start=10&sa=N </NU>
> </NB>
> -
> <R N="1" MIME="application/pdf">
> -
> <U>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf </U>
> -
> <UE>
>
http://shpolicy.shservices.org/administrative/InformationServices/housewide
>applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.
p
>df </UE>
> -
> <T>
> <b>Information</b> <b>Services</b> Software Purchasing
> </T>
> <RK>5</RK>
> <FS NAME="date" VALUE="2005-09-07"/>
> -
> <S>
> <b>...</b> Administrative Housewide Policy <b>Information</b>
> <b>Services</b> Software Purchasing Applicable<br> Campus: Salem and
> West Valley Hospitals Department Name: <b>Information</b> <b>...</b>
> </S>
> -
> <HAS>
> <L/>
> <C SZ="" CID="4_wracnOVC8:"/>
> </HAS>
> </R>
>
> I can send the parsing code but it's fairly straight forward and I
> didn't want to needlessly fill up the email.
>
> Any suggestions?
>
> Thanks,
> Robbert van Andel

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация