ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old September 3rd, 2011, 07:21 PM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
Well l've been kinda chasing an alt. route with this xml task.

I got all they way to the portion of page where I was defining

my search option and it blows up right in my face. Could you

let me know if I'm tackling it the right way?

xml file:
<album>
<title>Questions, unanswered</title>
<artist>Steve and the flubberblubs</artist>
<year>1989</year>
<tracks>
<song tracknumber="1" length="4:05">
<title>What do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:31</lastplayed>
</song>
<song tracknumber="2" length="3:45">
<title>Who do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:35</lastplayed>
</song>
<song tracknumber="3" length="5:14">
<title>When do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:39</lastplayed>
</song>
<song tracknumber="4" length="4:19">
<title>Do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:44</lastplayed>
</song>
</tracks>
</album>


mycfm:
<cfhttp url="http://localhost:8500/interviewtest/music.xml">


<!---<cfdump var="#cfhttp.FileContent#">--->


<cfset music = xmlparse("#cfhttp.FileContent#")>

<!---<cfdump var="#music#" label= "xml document object">--->

<cfset armusic=music.album.tracks.song>

<!---<cfdump var="#armusic[1].artist.xmltext#" label="armusic">--->
<cfscript>
if (isDefined("form.submitbutton"))
{
hql = "FROM armusic WHERE 0=0";
}


</cfscript>
<Title>Artist Search</Title>

<body>

<cfform>
<table border ="0">
<tr>
<td>Artist Search:

</td>
<td><input type="text" name="artist" size="30" </td>

</tr>
<tr>
<td><input type="submit" value="search" name="submitbutton"

</td>
</tr>
</table>
</cfform>
<cfif isDefined(armusic)>

</cfif>
/body>

Reply With Quote
  #17  
Old September 4th, 2011, 01:15 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
"Blows up in your face" doesn't provide any information I can use. Do you get an error? You've got to explain what happens, I can't read your mind.

Beyond that, I have no idea what this is:

Code:
if (isDefined("form.submitbutton"))
{
hql = "FROM armusic WHERE 0=0";
}


I also don't see any XPath in this code. I asked earlier but you didn't answer so I'll try again: have you actually read the CF documentation that covers XML and XPath?

Reply With Quote
  #18  
Old September 5th, 2011, 03:32 AM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
Ok sorry the message that I was getting with the code earlier had a problem with the script that i wanted to get working.


So I ended up going back to using the Xpath function. I was able to create a cfscript using an array that retrieves the title of the songs from the xml. I tested by using a writoutput tag in the script.

Now my only problem is that I can't seem to get this Search button to return the title. Please see below.


<cfhttp url="http://localhost:8500/interviewtest/music.xml">

<cfset music = xmlparse("#cfhttp.FileContent#")>
<!---<cfdump var="#cfhttp.FileContent#">--->




<!---<cfdump var="#music#" label= "xml document object">--->

<cfset armusic=music.album.tracks.song>

<cfscript>
if (isDefined("form.submitbutton"));
music = xmlparse("#cfhttp.FileContent#");
selectedElements = XmlSearch(music, "/album/tracks/song/title");
for (i = 1; i LTE Arraylen(selectedElements); i = i + 1)
writeoutput (selectedElements[i].xmltext & "<br>");


</cfscript>
<Title>Artist Search</Title>

<body>

<cfform>
<table border ="0">
<tr>
<td>Artist Search:

</td>
<td><input type="text" name="artist" size="30" </td>

</tr>
<tr>
<td><input type="submit" value="search" name="submitbutton"

</td>
</tr>
</table>
</cfform>
<cfif isDefined("selectedElements")>


</cfif>

Reply With Quote
  #19  
Old September 5th, 2011, 08:55 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Where are you matching the title?

Reply With Quote
  #20  
Old September 6th, 2011, 07:46 AM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
How would i match the title?

Reply With Quote
  #21  
Old September 6th, 2011, 07:48 AM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
I have created that script using the XMLSearch array. I though that was all that was needed to allow me to search.

The reason why is because when i use the writeoutput tag in my cfscript it gives me all the titles.

Reply With Quote
  #22  
Old September 6th, 2011, 08:17 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
That's because you're not using the value they entered into the form, but are just pulling out ALL of the titles.

Reply With Quote
  #23  
Old September 6th, 2011, 09:40 AM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
So should I be changing if (isDefined("form.submitbutton"));
to if(isDefined("form.search"))?

Reply With Quote
  #24  
Old September 6th, 2011, 11:23 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
No, you're missing the point. If your XPath search doesn't limit what it looks for to the value passed by the user in form.artist, how can you expect it to do anything OTHER than returning all of the artists? You're not filtering anything.

Reply With Quote
  #25  
Old September 6th, 2011, 12:19 PM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
ok now i see a little light..... about the filtering do I have to add a filter to my script? and if so what kind of tag would it be?

Reply With Quote
  #26  
Old September 6th, 2011, 02:13 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966

Reply With Quote
  #27  
Old September 7th, 2011, 06:06 PM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
ok thanks.......

Now I another question. I createded a .cfc file and a action cfm file to reference to it. I am plotting to create a grid in the cfm to display my xml files. Which were in previous post

I also want to be able to delete the data in this grid and add so that it writes back to the xml.

I think i got it pretty much covered but I get an error when loading my cfm The message states.

Error invoking CFC "path leading to my cfc file:"The row number 1 is out of bounds.

I assume that it may have something to do with one of my query's but im not to sure. Also thanks for all your help.


<cfcomponent name="ArtistDataManager">
<cffunction name="getArtist" access="remote" output="false" returnFormat="plain">
<cfhttp url="http://localhost:8500/interviewtest/music.xml">
<cfset biggie = xmlparse ("#cfhttp.FileContent#")>
<cfcontent type="text/xml" reset="yes">
<cfreturn biggie>
</cffunction>
<cffunction name="getData" access="remote" output="false">
<cfargument name="page" required="yes">
<cfargument name="pageSize" required="yes">
<cfargument name="sortCol" required="yes">
<cfargument name="sortDir" required="yes">
<cfargument name="filter" required="no">
<cfhttp url="http://localhost:8500/interviewtest/music.xml">
<cfset biggie = xmlparse ("#cfhttp.FileContent#")>
<cfset txe = biggie.album.tracks.song>
<cfset box = arraylen(txe)>
<cfset myquery = QueryNew("title, artist")>
<cfloop index="i" from = "1" to = #box#>
<cfset temp = QuerySetCell (myquery, "artist", #biggie.album.tracks.song[i].artist.xmltext#, #i#)>
<cfset temp = QuerySetCell (myquery, "title", #biggie.album.tracks.song[i].title.xmltext#, #i#)>
</cfloop>
<cfquery name="Search" datasource="myquery">
select TITLE, ARTIST from SONG
<cfif isDefined("arguments.filter") AND arguments.filter NEQ "">
where GENRE = '#arguments.filter#'

</cfif>
<cfif arguments.sortCol NEQ "" AND arguments.sortDir NEQ "">
order by #arguments.sortCol# #arguments.sortDir#
<cfelse>
order by TITLE ASC
</cfif>
</cfquery>

<cfreturn QueryConvertForGrid(Search, arguments.page,
arguments.pageSize)>
</cffunction>

<cffunction name="getArttitle" access="remote" output="false">
<cfargument name="prodname" default="The Song">

<cfquery name="SongDetails" datasource="myquery">
select TITLE, ARTIST from SONG
where TITLE = '#arguments.prodname#'
</cfquery>
<cfoutput>
<cfxml variable="MUSICXML" >
<album>
<title>Questions, unanswered</title>
<artist>Steve and the flubberblubs</artist>
<year>1989</year>
<tracks>
<song tracknumber="1" length="4:05">
<title>What do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:31</lastplayed>
</song>
<song tracknumber="2" length="3:45">
<title>Who do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:35</lastplayed>
</song>
<song tracknumber="3" length="5:14">
<title>When do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:39</lastplayed>
</song>
<song tracknumber="4" length="4:19">
<title>Do you know?</title>
<artist>Steve and the flubberblubs</artist>
<lastplayed>2006-10-17-08:44</lastplayed>
</song>
</tracks>
</album>
</cfxml>
</cfoutput>
<!--- Convert the XML object to an XML string. --->
<cfset xmldata = xmlparse(musicxml)>
<cfcontent type="text/xml" reset="yes">
<cfreturn xmldata>
</cffunction>

</cfcomponent>

Reply With Quote
  #28  
Old September 7th, 2011, 11:28 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
You're showing the CFC, not the code that is calling the CFC. The error should have a file and line number where the error is happening.

Reply With Quote
  #29  
Old September 8th, 2011, 12:56 PM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
The error message state the following:
Error invoking CFC/ColdfusionProject/artistdatamanager.cfc: The row number 1 is out of bounds.[Enable debugging by addming'cfdebug to our URL parameters to see more information]

Reply With Quote
  #30  
Old September 8th, 2011, 01:00 PM
absumter12 absumter12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 31 absumter12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 17 sec
Reputation Power: 2
Getting this message when i try to put up my cfm code to the forum.


Could not find phrase 'akismetspam'.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > XML page cannot be displayed

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap