• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Query to XML

Participant ,
Jun 16, 2006 Jun 16, 2006

Copy link to clipboard

Copied

How can I use this script to write an XML file from it?

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<CFQUERY NAME="qGetNav" DATASOURCE="#application.ds#">
SELECT T1ID, T1Name, Button_up, Button_dn, Alt_Text, header, ShortName,
Content
FROM Tier1
WHERE Live = true
ORDER BY ButtonLoc
</CFQUERY>

<CFQUERY NAME="qGetTier2" DATASOURCE="#application.ds#">
SELECT T2ID, T1IDFK, T2Name, Button_up, Button_dn, Alt_Text, header,
Content, allowcontent
FROM Tier2
WHERE Live = true
ORDER BY ButtonLoc
</CFQUERY>


<links>
<CFOUTPUT QUERY="qGetNav">

<cfif #url.ID# eq #T1ID#>
<link name="#T1Name#" ref="level1.cfm?ID=#T1ID#" active="1">
<cfelse>
<link name="#T1Name#" ref="level1.cfm?ID=#T1ID#">
</cfif>
<cfset parentID = #T1ID# >
<cfloop query="qGetTier2">
<cfif parentID eq #T1IDFK#><inLink name="#T2Name#" ref="level2.cfm?ID=#parentID#&T2ID=#T2ID#"/></cfif>
</cfloop>
</link>
</CFOUTPUT>
</links>
TOPICS
Advanced techniques

Views

217

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2006 Jun 16, 2006

Copy link to clipboard

Copied

LATEST
cutie369 wrote:
> How can I use this script to write an XML file from it?
>
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
> <CFQUERY NAME="qGetNav" DATASOURCE="#application.ds#">
> SELECT T1ID, T1Name, Button_up, Button_dn, Alt_Text, header, ShortName,
> Content
> FROM Tier1
> WHERE Live = true
> ORDER BY ButtonLoc
> </CFQUERY>
>
> <CFQUERY NAME="qGetTier2" DATASOURCE="#application.ds#">
> SELECT T2ID, T1IDFK, T2Name, Button_up, Button_dn, Alt_Text, header,
> Content, allowcontent
> FROM Tier2
> WHERE Live = true
> ORDER BY ButtonLoc
> </CFQUERY>
>
>
<cfxml variable="myXMLObj">
> <links>
> <CFOUTPUT QUERY="qGetNav">
>
> <cfif #url.ID# eq #T1ID#>
> <link name="#T1Name#" ref="level1.cfm?ID=#T1ID#" active="1">
> <cfelse>
> <link name="#T1Name#" ref="level1.cfm?ID=#T1ID#">
> </cfif>
> <cfset parentID = #T1ID# >
> <cfloop query="qGetTier2">
> <cfif parentID eq #T1IDFK#><inLink name="#T2Name#"
> ref="level2.cfm?ID=#parentID#&T2ID=#T2ID#"/></cfif>
> </cfloop>
> </link>
> </CFOUTPUT>
> </links>
</cfxml>

<cfdump var="myXmlObj">

<cffile action="write" .... output="#ToString(myXmlObj)#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation