Cheers Robert, not sure why I have never come across that before in the manual.
It seems to do all I want to do, but doesn’t give examples for how to do things like count(). I’ll look up XPATH in general on Google (assuming it’s a standard implementation) but would it be possible for you to specify an example which returns the number of relateditems? Wayne > On 8 Jan 2016, at 4:48 AM, Robert Shubert <rshub...@tronics.com> wrote: > > Wayne, > > You need to switch to the XPATH syntax. You can do all of what you are > looking for with that. > > XPOINTER is long dead, and won't be supported in future versions. It's > important that you switch to XPATH. > > Robert > > -----Original Message----- > From: Wayne Irvine [mailto:wa...@byteserve.com.au] > Sent: Thursday, January 07, 2016 3:32 AM > To: TeraScript-Talk@terascript.com > Subject: TeraScript-Talk: Retrieving data from XML > > I’ve been tasked with converting a large static site to dynamic database > driven CMS. > > The first step was downloading all the pages and then converting them to a > XML structure (see example below). I then load the text file into a DOM and > can pull out ELEMENTVALUES at will and inject them into tables. > > <@ASSIGN NAME="myDom" SCOPE="request" VALUE="<@DOM VALUE='@@datafile'>"> > > <@ELEMENTVALUE OBJECT="myDom" ATTRIBUTE+"UID" > XPOINTER="root().child(1).child(1)”> > > Returns 'Dinner Time Mr Wolf’. > > Can I refer to this by it’s name instead (UID)? > > Also, there are some pages that have repeating fields (one or more > relateditems). I would like to extract this data and inject it into a related > table. > > I can either got through each of the iterations and insert them individually > (requires a count of instances), or extract as an array and cycle through the > array. > > Is there a way of extracting the number of instances of a given field in an > XML DOM? > > Is there a way of extracting all instances at once as an array? > > Wayne Irvine > > Byteserve Pty Ltd > w: http://www.byteserve.com.au/ > e: i...@byteserve.com.au > p: +61 02 9960 6099 > m: 0409 960 609 > > <ppproduct> > <productdetails> > <UID>Dinner Time Mr Wolf</UID> > <description>A traditional playground game that can be used by > one or more children at a time, measuring approximately 7000mm x > 3000mm</description> > > <path>http://projectplaygrounds.com.au/playground-marking/traditional-games/dinner-time-mr-wolf</path> > <keywords>Mr Wolf, traditional Playground game, Feet, > thermoplastic, playground marking, thermal</keywords> > <description>A traditional playground game that can be used by > one or more children at a time, measuring approximately 7000mm x > 3000mm</description> > <title>Project Playgrounds Australia - Dinner Time Mr > Wolf</title> > <class>dinner-time-mr-wolf</class> > <category>Traditional Games</category> > <pagename>Dinner Time Mr Wolf" > href="dinner-time-mr-wolf">Dinner Time Mr Wolf</pagename> > <image>MRW1_1d4b061cb18e1df1af78940b6b43f4a9.jpg</image> > <image>MRW1_b9eeb4ce2e9e34768f77132648731760.jpg</image> > <price>1770.00</price> > <model>MRW2</model> > <manufacturer>Thermapply</manufacturer> > <width>300cm</width> > <length>700cm</length> > <weight>0.00kg</weight> > </productdetails> > > <relateditems> > <relateditem> > <relhref>hopscotch</relhref> > <title>Hopscotch</title> > <imgsrc>HOP1_2e34efbbc8dec3603114c23b8e245f67</imgsrc> > <imgalt>Hopscotch</imgalt> > <imgwidth>34</imgwidth> > <imgheight>120</imgheight> > </relateditem> > <relateditem> > <relhref>hopscotch-rocket-blue-fins</relhref> > <title>Hopscotch Rocket - Blue Fins</title> > <imgsrc>HOP3_07baf173863162a1d671d3fc39940761</imgsrc> > <imgalt>Hopscotch Rocket - Blue Fins</imgalt> > <imgwidth>64</imgwidth> > <imgheight>120</imgheight> > </relateditem> > <relateditem> > <relhref>hopscotch-rocket-red-fins</relhref> > <title>Hopscotch Rocket - Red Fins</title> > <imgsrc>HOP2_26cd42dbcfde0aadc5a4633f31b8945a</imgsrc> > <imgalt>Hopscotch Rocket - Red Fins</imgalt> > <imgwidth>59</imgwidth> > <imgheight>120</imgheight> > </relateditem> > <relateditem> > <relhref>mr-wolf</relhref> > <title>Mr Wolf</title> > <imgsrc>MRW1A_fbc5ff63ca013fb60a9ee0cd429a064e</imgsrc> > <imgalt>Mr Wolf</imgalt> > <imgwidth>114</imgwidth> > <imgheight>120</imgheight> > </relateditem> > </relateditems> > <previousitem></previousitem> > <next>hopscotch</next> > </ppproduct> > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to > lists...@terascript.com with "unsubscribe terascript-talk" in the body. > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to > lists...@terascript.com with "unsubscribe terascript-talk" in the body. > Wayne Irvine Byteserve Pty Ltd w: http://www.byteserve.com.au/ e: i...@byteserve.com.au p: +61 02 9960 6099 m: 0409 960 609 ---------------------------------------- To unsubscribe from this list, please send an email to lists...@terascript.com with "unsubscribe terascript-talk" in the body.