Advertisement

02.22.2008 at 03:49PM PST, ID: 23186287 | Points: 500
[x]
Attachment Details

dynamic XML

Asked by CosmicKoder in ColdFusion Studio, Extensible Markup Language (XML)

Tags: coldfusion XML

I have created a dynamic XML coldfusion file. It works great but it doesnt do everything i need it to. Currently the code i am using looks at one directory and generates a XML file based off of the contents of that directory. What i need it to do is look at multiple directories and generate a XML file. Below is the code noted of what it is doing and or i want it to do. The queraadcolumn and the query of queries is so it sorts the files properly when it generates the XML. In the XML it has a <gallery> tag that holds the albums. Right now i have only one <album>, hence looking at the contents of one directory. What i want the XML to do is look at multiple directories hence adding another <album>. Below is showing the ending XML structure i want created. The structure is based off of two directories inside of the same directory. Each directory is holding 5 JPEG's currently but i may have 1000 files in each directory.


Directory structure is : Photos/west/set1/large or Photos/east/set1/large

Thank You!

CosmicKoderStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
code i am using to look at a single directory and generate XML based off of the contents of that directory:
 
<cfdirectory action="LIST" directory="#GetDirectoryFromPath(GetBaseTemplatePath())#/photos/jayda/set1/large/" name="getPhotos" filter="*.jpg" sort="name">
<cfset queryaddcolumn(getPhotos,"mysort",ArrayNew(1))>
<cfloop query="getPhotos">
<cfset num = ListGetAt(name,1,".")>
<cfset querysetcell(getPhotos,"mysort",num,currentrow)>
</cfloop>
<cfquery name="dirlist_sorted" dbtype="query">
select *
from getPhotos
order by mysort
</cfquery>
<?xml version="1.0" encoding="UTF-8"?>
	<gallery>
		<album title="west Stage" lgPath="photos/west/set1/large/" tnPath="photos/west/set1/thumbs/">
	<cfloop query="dirlist_sorted"><img src="<cfoutput>#dirlist_sorted.Name#</cfoutput>"/>
	</cfloop>
		</album>
	</gallery>
 
 
How the ending XML should look when it is looking at multiple directories:
 
<?xml version="1.0" encoding="UTF-8"?>
	<gallery>
		<album title="West Stage" description="West Stage Set 1" lgPath="photos/West/set1/large/" tnPath="photos/West/set1/thumbs/">
	<img src="1.jpg"/>
	<img src="2.jpg"/>
	<img src="3.jpg"/>
	<img src="4.jpg"/>
	<img src="5.jpg"/>
		</album>
		<album title="East Stage" description="East Stage Set 2" lgPath="photos/East/set1/large/" tnPath="photos/East/set1/thumbs/">
	<img src="1.jpg"/>
	<img src="2.jpg"/>
	<img src="3.jpg"/>
	<img src="4.jpg"/>
	<img src="5.jpg"/>
		</album>
	</gallery>
 
 
[+][-]02.22.2008 at 08:18PM PST, ID: 20963631

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.23.2008 at 12:06AM PST, ID: 20964115

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.23.2008 at 12:27AM PST, ID: 20964160

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.24.2008 at 05:44PM PST, ID: 20972359

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628