onsfile_get_contents

file_get_contents  时间:2021-05-19  阅读:()
CopyrightIBMCorporation2010TrademarksSimulateXQueryandXIncludefunctionalitywithPHPPage1of8SimulateXQueryandXIncludefunctionalitywithPHPEnjoythepowerofXMLdataprocessinginwebprogrammingColinBeckinghamSeptember21,2010ManybrowserscanhandleXMLingeneral,butarecurrentlyweakintheirsupportofXQueryandXInclude.
YouneedtoworkaroundthisissuewhenyoubuildwebapplicationsthatcombineandprocessXML-structureddatafrommultiplesources.
UsingPHPisonesolution.
ThisarticlefirstshowshowyourwebpagescandeliverdataextractsfromXMLusingXQueryandXIncludeexplicitly,andthenhowtodotheequivalentworkwithPHP,allwithinthecontextofacooperativeeffortamonggardencenters.
XIncludeandXQueryareXMLtoolsthathelpwebprogrammersprocessdatadynamically.
XIncludeletsyoutreatmultipleXMLfilesasiftheywereonefile,andXQuerycanprocessthecombineddataandprepareitforinclusionintooutputforweb-pagedisplay.
Together,theyperformthisserviceelegantlyandefficientlywithfewlinesofcode.
FrequentlyusedacronymsHTTP:HypertextTransferProtocolW3C:WorldWideWebConsortiumXHTML:ExtensibleHypertextMarkupLanguageXML:ExtensibleMarkupLanguageXSL:ExtensibleStylesheetLanguageMostbrowserscandisplayandprocessXMLfileseitherdirectlyorincooperationwithXSLtemplates.
Inanidealworld,browserswouldunderstandXQueryandXIncludedirectlytoo.
Butatthispointtheysupportthesetoolsonlybyplacingunreasonabledemandsonusers—forexample,byrequiringthemtoloadexperimentaladd-ons.
Fetchingthedatafromwidelydifferentsourcesandcombiningthemintoonelargedatasetforprocessingcanbeapainstakingtaskforthewebprogrammer.
Throughahypotheticalbusinessexample,thisarticlefirstshowsyouthestrengthofthecombinationofXQueryandXInclude.
Thenyou'lllearnhowtousePHPtosimulatethefunctionalitythatXQueryandXIncludeprovide.
MovingallthedataprocessingtotheserversidegivesyouaworkaroundtolimitedbrowsersupportforXQueryandXInclude.
AnotherbenefitisthatPHPgivesyoumuchfinercontroloverthefinaloutputpresentation.
developerWorksibm.
com/developerWorks/SimulateXQueryandXIncludefunctionalitywithPHPPage2of8Example:Garden-centercooperationImaginethatatownhasthreegardencenters.
Theycompetewithoneanotherbutprovidesufficientlydifferentservicesthattheycandosocooperativelyratherthanantagonistically.
Theydosomemarketresearchtogetfindouthowtheircustomersbuytheirplants.
Inthehorticulturebusiness,salesofhighlyperishableproductsoccurinhighvolumeinashortperiodoftime,andcustomerscanbequiteparticularaboutthetypeandqualityofproductstheywant.
Itisinthebestinterestofthebusinesstogetthehigh-maintenanceproducts(forexample,thosethatneedtobewateredandkeptfreeofpests)outthedoorassoonaspossibleandtokeepamercurialcustomerbasehappybyprovidingthemwiththerightproductsattherighttimeandintherightplace.
Otherwisecustomersflocktothecompetitionthatcan.
Researchshowsthatcustomersdonotlikephoningaroundtofindwheretheycangettheirplants,andthehighvolumeofcallsisinconvenienttothebusinessesaswell.
Atthebeginningoftheseason,allthebusinesseshaveplentyofproduct.
Laterintheseason,despitegoodplanning,productstartstorunoutunevenly.
Customerslookingforpetuniasmighthavetophoneorvisitallthreegardencentersbeforetheyfindthehotpinkcolorthey'relookingfor.
Ingeneral,customerswanttoknowwhohaswhichplant,inwhatsizepot,inwhatquantity,andatwhatprice.
TheproposedsetupThethreeITmanagersholdameeting.
Theydecidetocreateacommonwebsitewherecustomerscanfindoutwhichgardencenterhasspecificplantsinstock.
Althoughallthreegardencentersarecomputerized,eachusesadifferentsystemtostoreinformation.
ApplesandThingsusesaMicrosoftAccessdatabasesystem,BirchTreesUnlimitedusesaLinuxsystemwithMySQL,andCarnationTarnationusesMacOSXwithIBMDB2.
Broadly,theydecidetoworktowardanXML-basedarchitecture.
XMLisaconvenientdataformatbecauseeachoftheirsystemscanexportcurrentdatatoanXMLfilethatisavailableinthecloud.
AmasterXMLfilecollectstheindividualstores'dataintoonecentralplace,usingXInclude.
Finally,themainwebpageexaminesthemasterfile,extractsthedatausingXQuery,andrendersthefinaldisplay.
ProcessingtheXMLwithXIncludeandXQueryTheITmanagersdecidethateachstorewillproduceanXMLfilesimilartotheoneinListing1:Listing1.
StoreXMLfile.
.
.
.
.
.
.
.
.
ibm.
com/developerWorks/developerWorksSimulateXQueryandXIncludefunctionalitywithPHPPage3of8PetuniaPink,in4inchpots1003.
00Appletree'Spartan'625.
00.
.
.
Thisfilehasastorerootelementandtwochildelements.
Theinfochildelementcontainsinformationaboutthestoreingeneral.
Theplantschildelementcontainsmanyplantchildelements,eachofwhichcontainsfurtherinformationaboutthatplant,includingthename,description,quantityandprice.
Allthreestoresfollowthispatternexactly.
Listing2istheirversionofamainXMLfilethatcombinesallthreestorefilessotheyappeartobeonelargefile,maintainingdetailsabouttheproducts:Listing2.
MainXMLfileInListing2,XIncludeisusedtofetchdatafromthethreelocationsusingHTTPinthecloud.
Afterprocessing,itlookslikeListing3:Listing3.
MainXMLfileexpandedApples.
.
.
.
.
.
Birches.
.
.
.
.
.
.
.
.
developerWorksibm.
com/developerWorks/SimulateXQueryandXIncludefunctionalitywithPHPPage4of8InListing3,theincludeinstructionsfromListing2arereplacedbythecontentsoftheindividualstoreXMLfiles.
EachstoreelementisnowachildelementoftheglobalstoreDataelement.
YoucannowapplyXQuerytothecombineddataset,asinListing4:Listing4.
ApplyingXQuery{for$storeindoc("mainXMLfile.
xml")/storeData/storelet$plants:=$store/plants/plantreturn{for$plantin$plantsorderby$plant/namereturn{concat($plant/quantity,"of",$plant/name,"at",$store/info/name,"for",$plant/price,"each")}

CloudServer:$4/月KVM-2GB/50GB/5TB/三个数据中心

CloudServer是一家新的VPS主机商,成立了差不多9个月吧,提供基于KVM架构的VPS主机,支持Linux或者Windows操作系统,数据中心在美国纽约、洛杉矶和芝加哥机房,都是ColoCrossing的机器。目前商家在LEB提供了几款特价套餐,最低月付4美元(或者$23.88/年),购买更高级别套餐还能三个月费用使用6个月,等于前半年五折了。下面列出几款特别套餐配置信息。CPU:1cor...

Gcore(gcorelabs)俄罗斯海参崴VPS简单测试

有一段时间没有分享Gcore(gcorelabs)的信息了,这是一家成立于2011年的国外主机商,总部位于卢森堡,主要提供VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日本、韩国、新加坡、荷兰、中国(香港)等多个国家和地区的十几个机房,商家针对不同系列的产品分为不同管理系统,比如VPS(Hosting)、Cloud等都是独立的用户中心体系,部落分享的主要是商家的Hosting(Virtu...

ZJI韩国BGP+CN2服务器,440元起

ZJI又上新了!商家是原Wordpress圈知名主机商:维翔主机,成立于2011年,2018年9月启用新域名ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务。本次商家新上韩国BGP+CN2线路服务器,国内三网访问速度优秀,适用8折优惠码,优惠后韩国服务器最低每月440元起。韩国一型CPU:Intel 2×E5-2620 十二核二十四线...

file_get_contents为你推荐
阿片类药物:您需要知道什么司机苹果5win7关闭445端口win7系统怎么关闭445和135这两个端口win10关闭445端口在win10 如何关闭445端口的最新相关信息win7telnet怎样在win7下打开telnet 命令google中国地图求教谷歌中国地图~手机如何使用?360chrome使用360急速浏览器,360chrome进程结束不了win7关闭135端口请问如何关闭135端口?googleadsencegoogle adsense打不开怎么办google分析谷歌的Search Console 和 Google Analytics有何区别
老域名全部失效请记好新域名 美国主机排名 商家促销 英文站群 本网站在美国维护 gspeed 双11秒杀 静态空间 tna官网 广州服务器 免费私人服务器 登陆空间 主机返佣 万网主机 服务器硬件配置 存储服务器 美国主机侦探 register.com webmin screen 更多