accomfund's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
3 (0 per day)
Joined:
25-September 12
Profile Views:
1,191
Last Active:
User is offline Sep 27 2012 08:34 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   accomfund has not set their status

Posts I've Made

  1. In Topic: How to parse ColdFusion XML file display multiple children

    Posted 25 Sep 2012

    [quote name='accomfund' date='25 September 2012 - 08:58 PM' timestamp='1348603135' post='1709393']

    View PostCraig328, on 25 September 2012 - 07:58 PM, said:

    Hello and welcome to D.I.C. accomfund.

    I don't do a lot of work with XML parsing but it seems you have a good example on line 8 of what to do further down, right? You build an array called CourseNodes from the results of an XMLSearch function at the Course level...why not do the same inside the loop that starts at line 11 for the ClassEvent level and then loop over that sub array?



    Okay, so I replace this:

    <b>Class Event ID:</b> #CourseXML.Course.CourseSchedule.ClassEvent.ClassEventID.xmlText#<br>
    <b>Start Date:</b>  #CourseXML.Course.CourseSchedule.ClassEvent.StartDate.xmlText#<br>
    <b>End Date:</b>  #CourseXML.Course.CourseSchedule.ClassEvent.EndDate.xmlText#<br>
    <b>Location:</b>  #CourseXML.Course.CourseSchedule.ClassEvent.Location.xmlText#<br>
    


    with this:

    <cfset ScheduleNodes = xmlSearch(WorkingXMLDoc,'/CourseInformation/Courses/Course/CourseSchedule/ClassEvent')>
    <cfloop from="1" to="#arraylen(ScheduleNodes)#" index="x">
    <cfset ScheduleXML = xmlparse(ScheduleNodes[x])>
    <strong>Class Event ID:</strong> #ScheduleXML.ClassEvent.ClassEventID.xmlText#<br>
    <strong>Start Date:</strong>  #ScheduleXML.ClassEvent.StartDate.xmlText#<br>
    <strong>End Date:</strong>  #ScheduleXML.ClassEvent.EndDate.xmlText#<br>
    <strong>Location:</strong>  #ScheduleXML.ClassEvent.Location.xmlText#<br><br>
    </cfloop>
    
    


    But that renders a list of ALL the Class Event ID info in all three of the individual courses (see below) -- can't work out how to loop within just the individual Course/CourseTitle.

    Course Title: Preparing for MCTS Windows Server 2008 Active Directory Exam 70-640
    Course Number: 1110

    Class Event ID: 12AE61US
    Start Date: 10/31/2012
    End Date: 11/02/2012
    Location: Washington, DC (Reston, VA)

    Class Event ID: 129A05US
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Washington, DC (Rockville, MD)

    Class Event ID: 129A06US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Washington, DC (Alexandria, VA)

    Class Event ID: 129A07US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Los Angeles

    Class Event ID: 129A00CN
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Ottawa

    Class Event ID: 12AA14US
    Start Date: 10/10/2012
    End Date: 10/12/2012
    Location: Washington, DC (Reston, VA)

    Course Title: Achieving ITIL Foundation Certification
    Course Number: 1197

    Class Event ID: 12AE61US
    Start Date: 10/31/2012
    End Date: 11/02/2012
    Location: Washington, DC (Reston, VA)

    Class Event ID: 129A05US
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Washington, DC (Rockville, MD)

    Class Event ID: 129A06US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Washington, DC (Alexandria, VA)

    Class Event ID: 129A07US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Los Angeles

    Class Event ID: 129A00CN
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Ottawa

    Class Event ID: 12AA14US
    Start Date: 10/10/2012
    End Date: 10/12/2012
    Location: Washington, DC (Reston, VA)

    Course Title: Cloud Computing Technologies: A Comprehensive Hands-On Introduction
    Course Number: 1200

    Class Event ID: 12AE61US
    Start Date: 10/31/2012
    End Date: 11/02/2012
    Location: Washington, DC (Reston, VA)

    Class Event ID: 129A05US
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Washington, DC (Rockville, MD)

    Class Event ID: 129A06US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Washington, DC (Alexandria, VA)

    Class Event ID: 129A07US
    Start Date: 09/26/2012
    End Date: 09/28/2012
    Location: Los Angeles

    Class Event ID: 129A00CN
    Start Date: 09/19/2012
    End Date: 09/21/2012
    Location: Ottawa

    Class Event ID: 12AA14US
    Start Date: 10/10/2012
    End Date: 10/12/2012
    Location: Washington, DC (Reston, VA)
  2. In Topic: How to parse ColdFusion XML file display multiple children

    Posted 25 Sep 2012

    View PostCraig328, on 25 September 2012 - 07:58 PM, said:

    Hello and welcome to D.I.C. accomfund.

    I don't do a lot of work with XML parsing but it seems you have a good example on line 8 of what to do further down, right? You build an array called CourseNodes from the results of an XMLSearch function at the Course level...why not do the same inside the loop that starts at line 11 for the ClassEvent level and then loop over that sub array?


    Yes, that's what I thought and tried that technique a couple different ways but all I could seem to get was a list of ALL

    View PostCraig328, on 25 September 2012 - 07:58 PM, said:

    Hello and welcome to D.I.C. accomfund.

    I don't do a lot of work with XML parsing but it seems you have a good example on line 8 of what to do further down, right? You build an array called CourseNodes from the results of an XMLSearch function at the Course level...why not do the same inside the loop that starts at line 11 for the ClassEvent level and then loop over that sub array?


    Sorry, accidental send: Yes, that's what I thought and tried that technique (loop over a sub array) a couple different ways but all I could seem to get was a list of ALL Course Event ID's - maybe my nesting structure was off - I will try that again...
    Thanks -

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

accomfund hasn't added any friends yet.

Comments

accomfund has no profile comments yet. Why not say hello?