Many thanks

I'm using CF5.

I don't think I can use XPATH queries as the soxml tag changes  
the xml to a structure (which I can see using cfdump)

It's "recursively walk through each element and extract the  
"text" portion of the nodes (the <MAIN> node and/or the <TN>  
node)" bit that I think I need to do but I'm just not sure how to  
go about it.
I can get everything else but I just can't work out how to get the  
image nodes <MAIN> & <TN> in each record

Any hints would be gratefully accepted 

Many thanks

Seamus

================ You wrote ================

>>
>>
>>> I can't work out how to get at the actual image names
>>
>>What version of CF are you running?
>>
>>If you are running CFMX then you should check out the  
documentation on XPATH in the <CFXML> tag area.
>>
>>If you aren't running CFMX then you might have to see if soXML  
supports XPATH queries of the XML document.  If it doesn't you may  
be able to find another add-in tag that does support XPATH.
>>
>>Otherwise, you really just have to recursively walk through each  
element and extract the "text" portion of the nodes (the <MAIN>  
node and/or the <TN> node).
>>
>>
>>Gary Menzel
>>IT Operations Brisbane -+- ABN AMRO Morgans Limited
>>Level 29, 123 Eagle Street BRISBANE QLD 4000
>>PH: 07 333 44 828  FX:  07 3834 0828
>>
>>[EMAIL PROTECTED] wrote on 07/04/2003  
08:00:54 AM:
>>
>>> Hi
>>> > I have an xml file which I parse with soxml tag (which  
changes it > to a structure)
>>> I then have to update a database with this.
>>> The updating is fine - apart from an images tag within each >  
record
>>> eg
>>> ....
>>> <IMAGES>
>>> <IMAGE>
>>> <MAIN>image01.jpg</MAIN>
>>> <TN>image02.jpg</TN>
>>> </IMAGE>
>>> <IMAGE>
>>> <MAIN>image03.jpg</MAIN>
>>> <TN>image04.jpg</TN>
>>> </IMAGE>
>>> </IMAGES>
>>> .....
>>> > The images tag may have zero or more "image" tags within it
>>> > I can't work out how to get at the actual image names
>>> > Below is my code (below that is the xml file) - I'm just >  
outputting the data at the moment.
>>> I know I need to somehow loop thru the images field within each  
> record but I just can't quite see how to do it
>>> > Can someone please help - this is driving me nuts > >  
===============================
>>> <cfset CurrentDirectory = >  
GetDirectoryFromPath(CGI.Path_Translated)>
>>> <cfset my_xml_file = "BoldInfoUpload.xml">
>>> <cf_SOXML >   action="XML2CF"
>>>   input="#CurrentDirectory#Source_Data/#my_xml_file#"
>>>   output="stBoldInfo"
>>>   type="file">
>>> <!--- Test to see if multiple new items exist --->
>>> <cfif isArray(stBoldInfo.records.record)>
>>> <!--- loop thru the records and display title, author, price  
(TI, AA, PR) etc --->
>>> > <cfloop index="idxRecords" from="1" >  
to="#ArrayLen(stBoldInfo.records.record)#">
>>> <cfscript>
>>> // Grab the nodes of info we want for "delete" operations
>>> // XB just tells me to either delete or add a record
>>> sRecordID = stBoldInfo.records.record[idxRecords].UR.value; >  
sInstruction = stBoldInfo.records.record[idxRecords].XB.value; >  
if (sInstruction eq "Add")
>>> // Grab the nodes of info we want for "add" operations
>>> {
>>> sAuthor = stBoldInfo.records.record[idxRecords].AA.value;
>>> sTitle = stBoldInfo.records.record[idxRecords].TI.value;
>>> // the rest of this bit is deleted here for brevity
>>> }
>>> </cfscript>
>>> <cfif sInstruction IS "Add">
>>> <cfoutput>#sRecordID# #sTitle# #sAuthor#</cfoutput> ADD <br>
>>> > <cfelse>
>>> <cfoutput>#sRecordID# </cfoutput> DELETE <br>
>>> </cfif>
>>> </cfloop>
>>> </cfif>
>>> > > ===============================
>>> > > > > <?xml version="1.0" encoding="iso-8859-1"?>
>>> <records>
>>> <record>
>>> <UR>1147</UR>
>>> <XB>delete</XB>
>>> </record>
>>> <record>
>>> <UR>1245</UR>
>>> <AA>BAYLEY, VICTOR.</AA>
>>> <AI></AI>
>>> <TI>Permanent Way Through the Khyber.</TI>
>>> <PU>Beacon Library Series. Jarrolds.</PU>
>>> <DP>1939.</DP>
>>> <MT>sou</MT>
>>> <KE>Afghanistan,Asia,India,Railway</KE>
>>> <NT>Ill, 2 lacking (of 16), 223pp, covers marked and faded,  
some > foxing. new text > Construction of the Khyber  
railway.</NT>
>>> <ED></ED>
>>> <BD></BD>
>>> <PR></PR>
>>> <IMAGES>
>>> <IMAGE>
>>> <MAIN>image01.jpg</MAIN>
>>> <TN>image02.jpg</TN>
>>> </IMAGE>
>>> <IMAGE>
>>> <MAIN>image03.jpg</MAIN>
>>> <TN>image04.jpg</TN>
>>> </IMAGE>
>>> </IMAGES>
>>> <XB>add</XB>
>>> </record>
>>> <record>
>>> <UR>1381</UR>
>>> <AA>BELL, GERTRUDE.</AA>
>>> <AI></AI>
>>> <TI>Persian Pictures.</TI>
>>> <PU>Boni &amp; Liveright. New York. Reprint.</PU>
>>> <DP>1928.</DP>
>>> <MT>mid</MT>
>>> <KE>Iran,Middle East,Persia</KE>
>>> <NT>Preface by Sir E. Denison Ross. 198pp, upper hinge split,  
paper > covered boards marked and worn at extremities.new text >  
Originally published anonymously in 1894 under the title 'Safar >  
Nameh. Persian Pictures. A Book of Travel'.</NT>
>>> <ED></ED>
>>> <BD></BD>
>>> <PR>35.00</PR>
>>> <IMAGES>
>>> <IMAGE>
>>> <MAIN>image01.jpg</MAIN>
>>> <TN>image02.jpg</TN>
>>> </IMAGE>
>>> <IMAGE>
>>> <MAIN>image03.jpg</MAIN>
>>> <TN>image04.jpg</TN>
>>> </IMAGE>
>>> </IMAGES>
>>> <XB>add</XB>
>>> </record>
>>> </records>


Seamus Campbell   Boldacious WebDesign
http://www.boldacious.com   ~~~~   [EMAIL PROTECTED]
ph 02 6297 4883   fax  02 6297 8464   mob 0410 609 267



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to