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")}

无忧云:洛阳BGP云服务器低至38.4元/月起;雅安高防云服务器/高防物理机优惠

无忧云怎么样?无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点。一、无忧云官网点击此处进入无忧云官方网站二...

国内云服务器 1核 2G 2M 15元/月 萤光云

标题【萤光云双十二 全场6折 15元/月 续费同价】今天站长给大家推荐一家国内云厂商的双十二活动。萤光云总部位于福建福州,其成立于2002 年。主打高防云服务器产品,主要提供福州、北京、上海 BGP 和香港 CN2 节点。萤光云的高防云服务器自带 50G 防御,适合高防建站、游戏高防等业务。这家厂商本次双十二算是性价比很高了。全线产品6折,上海 BGP 云服务器折扣更大 5.5 折(测试了一下是金...

百纵科技云主机首月9元,站群1-8C同价,美国E52670*1,32G内存 50M 899元一月

百纵科技:美国高防服务器,洛杉矶C3机房 独家接入zenlayer清洗 带金盾硬防,CPU全系列E52670、E52680v3 DDR4内存 三星固态盘阵列!带宽接入了cn2/bgp线路,速度快,无需备案,非常适合国内外用户群体的外贸、搭建网站等用途。官方网站:https://www.baizon.cnC3机房,双程CN2线路,默认200G高防,3+1(高防IP),不限流量,季付送带宽美国洛杉矶C...

file_get_contents为你推荐
glucanotransferasechromeSource163generatedgoogle日照职业技术学院RIZHAOlegraph支持ipadDescriptionios5css3圆角如何用CSS实现圆角矩形?重庆宽带测速重庆云阳电信宽带测速网址谁知道,帮个忙?iphone连不上wifi苹果手机为什么突然连不上家里的wifi?
什么是域名地址 smartvps webhostingpad 国内永久免费云服务器 174.127.195.202 iis安装教程 realvnc 免费网络电视 免费网站申请 phpmyadmin配置 vip购优惠 如何用qq邮箱发邮件 国外免费asp空间 爱奇艺会员免费试用 多线空间 彩虹云 yundun 四川电信商城 阿里云免费邮箱 免费的域名 更多