XML/XPath: Difference between revisions
Undo revision 6372 by Special:Contributions/KmgBi2 (User talk:KmgBi2) linkspam |
mNo edit summary |
||
Line 1:
[http://ustall.org/web/nardi.htm nardi] [http://ustall.org/web/nvidia-geforce.htm nvidia geforce 6600 gt 256mb] [http://saibso.org/canon-powershot.htm canon powershot a95 plus] [http://ustall.org/web/bas-armagnac.htm bas armagnac] [http://davte.info/library/html/saitek.htm saitek 52] [http://helmed.info/topic/bacio-katia/ bacio katia carolina] [http://helmed.info/topic/aegolius/ aegolius] [http://davte.info/library/html/borse-dell.htm borse dell energia] [http://amohseni.info/img/styles/bwv/ bwv 182] [http://amohseni.info/img/styles/the-king/ the king of the golden hall] [http://nobinters.org/centro-per.htm centro per pulizia del viso] [http://saibso.org/prescott.htm prescott 478] [http://helmed.info/topic/samsung-tft/ samsung tft] [http://bloprofeldi.info/lib/navigatore-satellitare.htm navigatore satellitare gps] [http://amohseni.info/img/styles/pattinaggio-foto/ pattinaggio foto] [http://nobinters.org/royal-gigolos.htm royal gigolos california dreamin extend] [http://amohseni.info/img/styles/where-the/ where the children play] [http://nobinters.org/acer-travelmate.htm acer travelmate 4001] [http://psisemiya.com/images/small/webranking/ webranking] [http://psisemiya.com/images/small/www-lycos/ www lycos] [http://nobinters.org/portami-in.htm portami in cielo] [http://kinunia.cn/viajes-com.htm viajes com mx] [http://kinunia.cn/kenwood-chef.htm kenwood chef major robot da cucina] [http://davte.info/library/html/battletech.htm battletech] [http://kinunia.cn/epson-emptw.htm epson emp-tw20] [http://amohseni.info/img/styles/inger-nilsson/ inger nilsson] [http://saibso.org/kosova-mp.htm kosova mp3] [http://helmed.info/topic/mix-vibes/ mix vibes pro 4] [http://nobinters.org/bollon.htm bollon] [http://psisemiya.com/images/small/macchine-da/ macchine da caffe in cialde] [http://chaba.info/qtek-/ qtek - pda phone 2020] [http://saibso.org/brother-tn.htm brother tn8000] [http://amohseni.info/img/styles/pc-da/ pc da tavolo] [http://amohseni.info/img/styles/benoit-musica/ benoit musica] [http://kinunia.cn/telefoni-con.htm telefoni con filo] [http://helmed.info/topic/generale-di/ generale di de gregori] [http://bloprofeldi.info/lib/antrozous.htm antrozous] [http://chaba.info/accessori-gps/ accessori gps] [http://davte.info/library/html/alimento-cane.htm alimento cane] [http://kinunia.cn/sachsen.htm sachsen] [http://amohseni.info/img/styles/link-esibizionisti/ link esibizionisti] [http://kinunia.cn/diffusori-e.htm diffusori e casse] [http://saibso.org/facce-di.htm facce di clown foto] [http://kinunia.cn/acer-aspire.htm acer aspire 5024wlmi turion ml34 512mb] [http://bloprofeldi.info/lib/if-god.htm if god will send his angels] [http://ashythro.info/library/html/g-mazzini/ g mazzini giovine italia] [http://ustall.org/web/cavalie.htm cavalie] [http://bloprofeldi.info/lib/hamster-ball.htm hamster ball] [http://psisemiya.com/images/small/robbie-williams/ robbie williams. nobody someday] [http://davte.info/library/html/la-bayadere.htm la bayadere] [http://helmed.info/topic/high-grow/ high grow] [http://kinunia.cn/sms-logo.htm sms logo nec e606] [http://ustall.org/web/manu.htm manu] [http://ustall.org/web/monitor-lg.htm monitor lg 19 lcd] [http://bloprofeldi.info/lib/il-processo.htm il processo del secolo] [http://psisemiya.com/images/small/oakley-iridium/ oakley iridium] [http://kinunia.cn/monitor-benq.htm monitor benq lcd 19 fp931] [http://davte.info/library/html/soledad.htm soledad] [http://kinunia.cn/forster-john.htm forster, john] [http://nobinters.org/lultima-pattuglia.htm lultima pattuglia] [http://davte.info/library/html/offerte-lavoro.htm offerte lavoro infermieri svizzera] [http://kinunia.cn/most.htm most] [http://saibso.org/oh-happy.htm oh happy days sister act] [http://saibso.org/mobiline.htm mobiline] [http://saibso.org/i-nostri.htm i nostri sogni] [http://psisemiya.com/images/small/on-my/ on my knees 411] [http://nobinters.org/sapphire-x.htm sapphire x550 256mb] [http://amohseni.info/img/styles/i-want/ i want to miss a thing] [http://davte.info/library/html/breath-midge.htm breath midge ure] [http://helmed.info/topic/iposte/ iposte] [http://nobinters.org/www-formaper.htm www formaper com] [http://nobinters.org/formulario-giuridico.htm formulario giuridico] [http://nobinters.org/lo-scandalo.htm lo scandalo del vestito bianco] [http://ustall.org/web/boow.htm boow] [http://psisemiya.com/images/small/calma-e/ calma e sangu freddo] [http://ashythro.info/library/html/anello-elica/ anello elica] [http://saibso.org/creazione-sito.htm creazione sito internet albenga] [http://davte.info/library/html/protezione-lcd.htm protezione lcd] [http://psisemiya.com/images/small/castelrotto-val/ castelrotto val gardena] [http://bloprofeldi.info/lib/offertorio.htm offertorio] [http://psisemiya.com/images/small/finanziamento-lucca/ finanziamento lucca] [http://saibso.org/volo-montreal.htm volo montreal] [http://kinunia.cn/immagini-ragazze.htm immagini ragazze nude gratis] [http://bloprofeldi.info/lib/dj-di.htm dj di musica electronica in italia] [http://ustall.org/web/stupid-girl.htm stupid girl] [http://chaba.info/voss-johann/ voss, johann heinrich] [http://chaba.info/monitor-lcd/ monitor lcd tuner] [http://kinunia.cn/diesel-camicie.htm diesel camicie donna] [http://davte.info/library/html/albergo-cortina.htm albergo cortina d ampezzo] [http://nobinters.org/barabba.htm barabba] [http://ustall.org/web/cheap-and.htm cheap and chic] [http://chaba.info/sparkle-gf/ sparkle gf6600 256mb pci-express] [http://psisemiya.com/images/small/una-corsa/ una corsa sul prato] [http://ustall.org/web/merz-backstage.htm merz backstage] [http://davte.info/library/html/gps-blue.htm gps blue tooth nemerix] [http://chaba.info/schede-video/ schede video per pc] [http://amohseni.info/img/styles/divinacommedia/ divinacommedia] [http://nobinters.org/lettore-dvd.htm lettore dvd divx dv-380-s] [http://saibso.org/yuiop.htm yuiop] [http://nobinters.org/animaciones-flash.htm animaciones flash] [http://bloprofeldi.info/lib/forio-ischia.htm forio ischia] [http://kinunia.cn/o-zone.htm o zone mai ia hii] [http://kinunia.cn/lombra-della.htm lombra della vendetta] [http://kinunia.cn/c-olympus.htm c8080 olympus] [http://nobinters.org/telefonino-samsung.htm telefonino samsung z300] [http://nobinters.org/mp.htm mp3 1] [http://kinunia.cn/u-got.htm u got your self] [http://davte.info/library/html/fairfield-australia.htm fairfield (australia)] [http://davte.info/library/html/hotel-villamarina.htm hotel villamarina di cesenatico] [http://amohseni.info/img/styles/kenwood-w/ kenwood w6531] [http://ustall.org/web/capareza.htm capareza] [http://psisemiya.com/images/small/rondanina/ rondanina] [http://ashythro.info/library/html/donna-reed/ donna reed] [http://nobinters.org/nuove-immagini.htm nuove immagini senza preavviso] [http://kinunia.cn/buddha-bar.htm buddha bar vi] [http://ustall.org/web/rayban-occhiali.htm rayban occhiali] [http://saibso.org/poetare.htm poetare] [http://saibso.org/behringer-kt.htm behringer kt108] [http://chaba.info/paragonite/ paragonite] [http://psisemiya.com/images/small/settimana-bianca/ settimana bianca a pila] [http://helmed.info/topic/baloon-/ baloon 5 traduzione] [http://amohseni.info/img/styles/is-it/ is it cos im cool] [http://davte.info/library/html/jvc-ths.htm jvc th-s1] [http://psisemiya.com/images/small/box-esterno/ box esterno 3 5 usb ata] [http://davte.info/library/html/manubrio-kg.htm manubrio kg] [http://helmed.info/topic/vacanze-ottobre/ vacanze ottobre] [http://nobinters.org/stacy-fergusson.htm stacy fergusson] [http://davte.info/library/html/philips-impianti.htm philips impianti hi-fi] [http://bloprofeldi.info/lib/velsen.htm velsen] [http://helmed.info/topic/zephir-condizionatore/ zephir condizionatore] [http://saibso.org/casamicciola.htm casamicciola] [http://davte.info/library/html/fan-fiction.htm fan fiction site] [http://chaba.info/sermon/ sermon] [http://bloprofeldi.info/lib/barbara-durso.htm barbara durso] [http://chaba.info/locali-hard/ locali hard] [http://ashythro.info/library/html/trittico-damore/ trittico damore] [http://ashythro.info/library/html/kodak-/ kodak - easyshare cx7330] [http://ustall.org/web/ups.htm ups 650] [http://davte.info/library/html/macchine-caffe.htm macchine caffe krups] [http://psisemiya.com/images/small/losing-my/ losing my] [http://chaba.info/tiziana-sensi/ tiziana sensi] [http://ustall.org/web/fuji-.htm fuji - finepix s5500] [http://kinunia.cn/jennifer-connelly.htm jennifer connelly nuda] [http://saibso.org/fort-washington.htm fort washington - vita da cani] [http://amohseni.info/img/styles/scarpe-lizard/ scarpe lizard] [http://bloprofeldi.info/lib/time-to.htm time to rock] [http://kinunia.cn/la-mano.htm la mano che uccide] [http://helmed.info/topic/porsche/ porsche 2003 996] [http://chaba.info/franchising-abbronzatura/ franchising abbronzatura] [http://amohseni.info/img/styles/vaio-/ vaio 17 notebook] [http://chaba.info/auto-noleggio/ auto noleggio benevento] [http://kinunia.cn/frigoriferi-incasso.htm frigoriferi incasso 320] [http://davte.info/library/html/ituiutaba.htm ituiutaba] [http://bloprofeldi.info/lib/set-posate.htm set posate] [http://chaba.info/con-origen/ con origen nel deserto della california] [http://nobinters.org/gay-e.htm gay e transex] [http://amohseni.info/img/styles/stefania-lay/ stefania lay] [http://helmed.info/topic/curriculum-vitae/ curriculum vitae europeo] [http://ashythro.info/library/html/un-medico/ un medico in famiglia. prima serie. vol. 01] [http://amohseni.info/img/styles/www-roten/ www roten com] [http://bloprofeldi.info/lib/monitor-yakumo.htm monitor yakumo 17 lcd] [http://helmed.info/topic/seit-elettronica/ seit elettronica srl] [http://nobinters.org/hard-disck.htm hard disck 80gb] [http://chaba.info/fiat-punto/ fiat punto 1.2 16v sporting] [http://chaba.info/canon-cblue/ canon cb-2lue] [http://amohseni.info/img/styles/godwin-austen/ godwin austen] [http://nobinters.org/motoraduni-.htm motoraduni 2004 vicenza] [http://nobinters.org/emma-shapplin.htm emma shapplin - carmine meo] [http://bloprofeldi.info/lib/danu.htm danu] [http://bloprofeldi.info/lib/righeira-karaoke.htm righeira karaoke] [http://amohseni.info/img/styles/calciocom/ calcio.com] [http://chaba.info/konica-minolta/ konica minolta dimage 600] [http://kinunia.cn/rebel-a.htm rebel a k a] [http://bloprofeldi.info/lib/forno-con.htm forno con piano cottura] [http://saibso.org/clipart-cobra.htm clipart cobra] [http://saibso.org/videochatgratis.htm videochatgratis] [http://bloprofeldi.info/lib/accessori-per.htm accessori per interni audi 4] [http://bloprofeldi.info/lib/miratoio.htm miratoio] [http://amohseni.info/img/styles/mac-os/ mac os 10 4 tiger] [http://chaba.info/sacrifice-by/ sacrifice by lisa gerard and peter burke] [http://ustall.org/web/von-savigny.htm von savigny] [http://bloprofeldi.info/lib/udo-samel.htm udo samel] [http://psisemiya.com/images/small/jamie-walters/ jamie walters songs] [http://ustall.org/web/top-sensation.htm top sensation] [http://ustall.org/web/dulce-maria.htm dulce maria clase 406] [http://saibso.org/posto-al.htm posto al sole rai it] [http://davte.info/library/html/bella-balilla.htm bella balilla] [http://chaba.info/platinum-wall/ platinum wall] [http://bloprofeldi.info/lib/dating-sites.htm dating sites] [http://kinunia.cn/tu-che.htm tu che] [http://davte.info/library/html/foto-arcuri.htm foto arcuri] [http://nobinters.org/totali-.htm totali spies] [http://kinunia.cn/frigorifero-no.htm frigorifero no frost classe a silver] [http://bloprofeldi.info/lib/miguel-bose.htm miguel bose super superman] [http://saibso.org/omicidio-per.htm omicidio per vocazione] [http://davte.info/library/html/minueto.htm minueto] [http://helmed.info/topic/la-celiachia/ la celiachia] [http://amohseni.info/img/styles/notebook-schede/ notebook schede acquisizione e tv] [http://nobinters.org/lamiere-reggio.htm lamiere reggio emilia] [http://bloprofeldi.info/lib/rx-v.htm rx v2500] {{task}}
Perform the following three XPath queries on the XML Document below:
Line 87:
</cfsavecontent>
<cfset xml = xmlParse(xmlString)>
|
Revision as of 23:08, 17 August 2007
nardi nvidia geforce 6600 gt 256mb canon powershot a95 plus bas armagnac saitek 52 bacio katia carolina aegolius borse dell energia bwv 182 the king of the golden hall centro per pulizia del viso prescott 478 samsung tft navigatore satellitare gps pattinaggio foto royal gigolos california dreamin extend where the children play acer travelmate 4001 webranking www lycos portami in cielo viajes com mx kenwood chef major robot da cucina battletech epson emp-tw20 inger nilsson kosova mp3 mix vibes pro 4 bollon macchine da caffe in cialde qtek - pda phone 2020 brother tn8000 pc da tavolo benoit musica telefoni con filo generale di de gregori antrozous accessori gps alimento cane sachsen link esibizionisti diffusori e casse facce di clown foto acer aspire 5024wlmi turion ml34 512mb if god will send his angels g mazzini giovine italia cavalie hamster ball robbie williams. nobody someday la bayadere high grow sms logo nec e606 manu monitor lg 19 lcd il processo del secolo oakley iridium monitor benq lcd 19 fp931 soledad forster, john lultima pattuglia offerte lavoro infermieri svizzera most oh happy days sister act mobiline i nostri sogni on my knees 411 sapphire x550 256mb i want to miss a thing breath midge ure iposte www formaper com formulario giuridico lo scandalo del vestito bianco boow calma e sangu freddo anello elica creazione sito internet albenga protezione lcd castelrotto val gardena offertorio finanziamento lucca volo montreal immagini ragazze nude gratis dj di musica electronica in italia stupid girl voss, johann heinrich monitor lcd tuner diesel camicie donna albergo cortina d ampezzo barabba cheap and chic sparkle gf6600 256mb pci-express una corsa sul prato merz backstage gps blue tooth nemerix schede video per pc divinacommedia lettore dvd divx dv-380-s yuiop animaciones flash forio ischia o zone mai ia hii lombra della vendetta c8080 olympus telefonino samsung z300 mp3 1 u got your self fairfield (australia) hotel villamarina di cesenatico kenwood w6531 capareza rondanina donna reed nuove immagini senza preavviso buddha bar vi rayban occhiali poetare behringer kt108 paragonite settimana bianca a pila baloon 5 traduzione is it cos im cool jvc th-s1 box esterno 3 5 usb ata manubrio kg vacanze ottobre stacy fergusson philips impianti hi-fi velsen zephir condizionatore casamicciola fan fiction site sermon barbara durso locali hard trittico damore kodak - easyshare cx7330 ups 650 macchine caffe krups losing my tiziana sensi fuji - finepix s5500 jennifer connelly nuda fort washington - vita da cani scarpe lizard time to rock la mano che uccide porsche 2003 996 franchising abbronzatura vaio 17 notebook auto noleggio benevento frigoriferi incasso 320 ituiutaba set posate con origen nel deserto della california gay e transex stefania lay curriculum vitae europeo un medico in famiglia. prima serie. vol. 01 www roten com monitor yakumo 17 lcd seit elettronica srl hard disck 80gb fiat punto 1.2 16v sporting canon cb-2lue godwin austen motoraduni 2004 vicenza emma shapplin - carmine meo danu righeira karaoke calcio.com konica minolta dimage 600 rebel a k a forno con piano cottura clipart cobra videochatgratis accessori per interni audi 4 miratoio mac os 10 4 tiger sacrifice by lisa gerard and peter burke von savigny udo samel jamie walters songs top sensation dulce maria clase 406 posto al sole rai it bella balilla platinum wall dating sites tu che foto arcuri totali spies frigorifero no frost classe a silver miguel bose super superman omicidio per vocazione minueto la celiachia notebook schede acquisizione e tv lamiere reggio emilia rx v2500
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
Perform the following three XPath queries on the XML Document below:
- Retrieve the first "item" element
- Perform an action on each "price" element (print it out)
- Get an array of all the "name" elements
XML Document:
<inventory title="OmniCorp Store #45x10^3"><item upc="123456789" stock="12"> <name>Invisibility Cream</name> <price>14.50</price> <description>Makes you invisible</description> </item> <item upc="445322344" stock="18"> <name>Levitation Salve</name> <price>23.99</price> <description>Levitate yourself for up to 3 hours per application</description> </item> <item upc="485672034" stock="653"> <name>Blork and Freen Instameal</name> <price>4.95</price> <description>A tasty meal in a tablet; just add water</description> </item> <item upc="132957764" stock="44"> <name>Grob winglets</name> <price>3.56</price> <description>Tender winglets of Grob. Just add water</description> </item> </inventory>
C#
XmlReader XReader; // Either read the xml from a string ... XReader = XmlReader.Create(new StringReader("<inventory title=... </inventory>")); // ... or read it from the file system. XReader = XmlReader.Create("xmlfile.xml"); // Create a XPathDocument object (which implements the IXPathNavigable interface) // which is optimized for XPath operation. (very fast). IXPathNavigable XDocument = new XPathDocument(XReader); // Create a Navigator to navigate through the document. XPathNavigator Nav = XDocument.CreateNavigator(); Nav = Nav.SelectSingleNode("//item"); // Move to the first element of the selection. (if available). if(Nav.MoveToFirst()) { Console.WriteLine(Nav.OuterXml); // The outer xml of the first item element. } // Get an iterator to loop over multiple selected nodes. XPathNodeIterator Iterator = XDocument.CreateNavigator().Select("//price"); while (Iterator.MoveNext()) { Console.WriteLine(Iterator.Current.Value); } Iterator = XDocument.CreateNavigator().Select("//name"); // Use a generic list. List<string> NodesValues = new List<string>(); while (Iterator.MoveNext()) { NodesValues.Add(Iterator.Current.Value); } // Convert the generic list to an array and output the count of items. Console.WriteLine(NodesValues.ToArray().Length);
ColdFusion
<cfsavecontent variable="xmlString"> <inventory ... </inventory> </cfsavecontent> <cfset xml = xmlParse(xmlString)>