home Links Articles Books Past Meetings Photos SiteMap
The MDCFUG is sponsored by TeraTech. Visit us at www.TeraTech.com

Please send
comments/questions to

michael@
teratech.com

 
PPT Slide

PPT Slide

    Example: Manipulating XML

    <CFFILE ACTION="Read" FILE="d:\cfusionmx\wwwroot\mdcfug\MacromediaXmlFeed.xml" VARIABLE="MyXML">
    <CFSET DesDev = XmlParse(MyXML)>
    <CFSET Size = ArrayLen(DesDev.Macromedia_Resources.XmlChildren)>
    <CFSET MyQuery = QueryNew("resource, title, author, url, product") >
    <CFSET QueryAddRow(MyQuery, Size)>
    <CFLOOP INDEX="i" FROM="1" TO="#Size#">
    <CFSET ThisProd = "">
    <CFSET QuerySetCell(MyQuery, "resource", DesDev.Macromedia_Resources.Resource[i].XmlAttributes.Type, i)>
    <CFSET QuerySetCell(MyQuery, "title", DesDev.Macromedia_Resources.Resource[i].Title.XmlText, i)>
    <CFSET QuerySetCell(MyQuery, "author", DesDev.Macromedia_Resources.Resource[i].Author.XmlText, i)>
    <CFSET QuerySetCell(MyQuery, "url", DesDev.Macromedia_Resources.Resource[i].Url.XmlText, i)>
    <!--- get the number of products by looping over the entire XMLChildren array and pulling out only product items. This is necessary because
    an item can pertain to more than one product. --->
    <CFSET NumOfProd = ArrayLen(DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren)>
    <CFLOOP INDEX="j" FROM="1" TO="#NumOfProd#">
    <CFIF DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren[j].XmlName IS "product">
    <CFSET ThisProd = ListAppend(ThisProd, DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren[j].XmlAttributes.Name)>
    </CFIF>
    </CFLOOP>
    </CFLOOP>
    <CFDUMP VAR="#MyQuery#">

Previous slide Next slide Back to first slide View graphic version


Home | Links | Articles | Past Meetings | Meeting Photos | Site Map
About MDCFUG | Join | Mailing List |Forums | Directions |Suggestions | Quotes | Newbie Tips
TOP

Copyright © 1997-2017, Maryland Cold Fusion User Group. All rights reserved.
< >