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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4