House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

CFLOOP and XML not working!

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hello,
Shawn Contreras
07/01/03 01:09 P
Will someone please help me below??
Shawn Contreras
07/02/03 12:44 A
> Will someone please help me below???
Joe Eugene
07/02/03 01:04 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Shawn Contreras
07/01/2003 01:09 PM

Hello, I know that I am close but for some reason I cannot get the CFLOOP to work with this XML document. I am only getting 1 items listed in this XML document when I know that there are at least 8.  Here is the XML definition and layout: IRXML - This is the root element of the XML file. FAQS - Child element of IRXML. Contains one to many FAQ elements. FAQ - Child element of FAQS with 0 to many occurrences. ID - Numeric Attribute of FAQ. The unique identifier of the question and answer pair. DLU - Numeric date attribute of FAQ. Date the question and answer pair was last updated. Question - Child of FAQ.  The value of this element is the text articulating the frequently asked question. <![CDATA[Question’s text]]> Answer - Child of FAQ.  The value of this element is the text articulating the corresponding, frequently asked question’s answer. <![CDATA[Answer’s text]]> <IRXML CorpMasterID="132066">    <FAQS PubDate="20020506" PubTime="12:50:56">        <FAQ ID="9999" DLU="20010824 10:16:00">             <Question>                <![CDATA[  Can I buy or sell stock through CompanyX?   ]]>             </Question>             <Answer>                <![CDATA[ Steelcase does not currently have a plan in place to sell stock directly to the public. From time to time Steelcase reviews various plans for direct stock purchase. If a decision is made to launch such a program, shareholders will be notified and information would be included on this web site.    ]]>              </Answer>         </FAQ>         <FAQ ID="9998" DLU="20010824 10:17:00">             <Question>                 <![CDATA[ When was CompanyX’s initial public offering and at what price was its stock offered?   ]]>             </Question>             <Answer>                 <![CDATA[ February 17, 1998 and stock was offered at $28.00 per share.   ]]>              </Answer>          </FAQ>    </FAQS> </IRXML> My Code: <CFSET xmlobj = xmlParse(cfhttp.fileContent, false)> <CFSET FAQS = xmlobj.irxml> <CFSET FAQList = xmlobj.irxml.FAQS.FAQ> <CFSET Ques = FAQList.Question.xmltext> <CFSET Ans = FAQList.Answer.xmltext> <CFSET PRList = ArrayLen(FAQList.xmlChildren)> <CFOUTPUT>   <div align="center">Number of FAQs: <font color="##FF0000"><strong>#PRList#</strong></font></div> <br> <CFLOOP from="1" to="#ArrayLen(FAQList.xmlChildren)#" index="i"> <table width="100%" border="0" cellspacing="0" cellpadding="0">   <tr>     <td width="25"></td>         <td>#FAQList[i].xmlAttributes["ID"]# <br> <strong>#Ques#</strong></td>     <td> </td>   </tr>   <tr>     <td width="25"></td>     <td><div align="left">#Ans#</div></td>     <td width="35"> </td>   </tr>   <tr>     <td> </td>     <td> </td>     <td> </td>   </tr>   <tr>     <td bgcolor="##000099"></td>     <td bgcolor="##000099"></td>     <td height="1"></td>   </tr>   <tr>     <td> </td>     <td> </td>     <td height="12"> </td>   </tr> </table>   </cfloop> </CFOUTPUT> Thank you in advance for any assistance. B. Regards, Shawn Contreras

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Shawn Contreras
07/02/2003 12:44 AM

Will someone please help me below???

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Joe Eugene
07/02/2003 01:04 AM

> Will someone please help me below??? Where is your question? Joe Eugene > Will someone please help me below???

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Joe Eugene
07/02/2003 01:12 AM

> <CFSET FAQList = xmlobj.irxml.FAQS.FAQ> Your code is pulling only the first array of FAQ..elements. > <IRXML CorpMasterID="132066"> >    <FAQS PubDate="20020506" PubTime="12:50:56"> >        <FAQ ID="9999" DLU="20010824 10:16:00"> <cfset faqObjs = xmlObj.IRXML.FAQS /> Will give you all the Faq's , then iterate through "faqObjs" to dump your data or whatever. Joe Eugene ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     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     

Designer, Developer and mobile workflow conference