I can't seem to get the "src" attribute of the <img /> node.  I get the 
following error:  Element XMLCHILDREN.XMLATTRIBUTES is undefined in 
CNTHISALBUM. 
35 :    <CFSET ImgScr  = xnThisAlbum.XmlChildren.XmlAttributes["src"]>

1. <gallery>
2.   <album id="Landscape" path="gallery/landscape/">
3.      <img src="DCS002.JPG"/>
4.      <img src="DCS003.JPG"/>
5.   </album>
6.   <album id="Commercal" path="gallery/commercal/>
7.      <img src="DCS004.JPG"/>
8.      <img src="DCS005.JPG"/>
9.   </album>
10.   <album id="Portrait"  path="gallery/portrait/>
11.     <img src="DCS006.JPG"/>
12.     <img src="DCS007.JPG"/>
13.  </album>

14. <CFSET MyXmlFile = ExpandPath("gallery.xml")>

15. <!--- 2. Read XML file into string variable called MyXmlCode --->
16. <CFFILE ACTION="READ" FILE="#MyXmlFile#" VARIABLE="MyXmlCode">

17. <!---  Parse the XML into an XML "Object" --->

18. <CFSET MyXml = XmlParse(MyXmlCode)>

19. <!--- The "root element" of this XML Object --->
20. <CFSET rnGallery = MyXML.XmlRoot>

21. <!--- grab the child element's "id" attribute --->
22. <CFSET cnAlbumID  = xnGallery.sAlbum.XmlAttributes["id"]>

23. <!--- How many immediate children of <company> are there? --->
24. <CFSET nNumAlbums = ArrayLen(xnGallery.XmlChildren)>

25. <p>
26. <CFLOOP FROM="1" TO="#nNumAlbums#" INDEX="i">
27.     <!--- Grab values from the XML document --->
28.     <CFSET cnThisAlbum = rnGallery.XmlChildren[i]>
29.     <CFSET cnAlbumName = cnThisAlbum.XmlAttributes["id"]>
    
30.     <cfoutput>
31.          <!--- output the album name --->
32.            #cnAlbumName#<br />
33.    <CFSET ImgPath = cnThisAlbum.XmlAttributes["path"]>      
34.   <!--- HERE IS WHER I LOSE IT! NEED HELP WITH THE CORRECT SYNTAX ---> 
35.    <CFSET ImgScr =  cnThisAlbum.XmlChildren.XmlAttributes["src"]>
        
36.          <!--- Display image --->
37.      <img scr"#ImgPath##ImgScr#"><br />
38.  <br />

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237128
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to