> 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 & 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/
****************************************************************************
If this communication is not intended for you and you are not an authorised
recipient of this email you are prohibited by law from dealing with or
relying on the email or any file attachments. This prohibition includes
reading, printing, copying, re-transmitting, disseminating, storing or in
any other way dealing or acting in reliance on the information. If you
have received this email in error, we request you contact ABN AMRO Morgans
Limited immediately by returning the email to [EMAIL PROTECTED]
and destroy the original. We will refund any reasonable costs associated
with notifying ABN AMRO Morgans. This email is confidential and may contain
privileged client information. ABN AMRO Morgans has taken reasonable steps
to ensure the accuracy and integrity of all its communications, including
electronic communications, but accepts no liability for materials
transmitted. Materials may also be transmitted without the knowledge of ABN
AMRO Morgans. ABN AMRO Morgans Limited its directors and employees do not
accept liability for the results of any actions taken or not on the basis
of the information in this report. ABN AMRO Morgans Limited and its
associates hold or may hold securities in the companies/trusts mentioned
herein. Any recommendation is made on the basis of our research of the
investment and may not suit the specific requirements of clients.
Assessments of suitability to an individual's portfolio can only be made
after an examination of the particular client's investments, financial
circumstances and requirements.
****************************************************************************
---
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/