ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
  #1  
Old July 22nd, 2006, 04:31 PM
Caden Caden is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 273 Caden User rank is Private First Class (20 - 50 Reputation Level)Caden User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 7 h 19 m 28 sec
Reputation Power: 4
Updating and Deleting from XML

Started a new thread because the other one was kind of getting convoluted, I hope that's alright.

I think I am one or two small pieces away from wrapping my head around this, so a little help would be magnificient.

I can create an XML file, and append to it using a form and a post page, I can pull the data back using xmlParse to get the data into an array like format.

After finding examples I was able to pull the data back from the XMl page and turn it into a query format, which I can use SQL to pull off of, so I can display easily.

The last pieces that I can't get my head around are updating and deleting. I know there are built in functions to handle these events, but I just can't find a good reference or example of how to utalize these functions. I've been checking my books and looking online, so any help would be huge.

Thanks for all the help so far.

Reply With Quote
  #2  
Old July 23rd, 2006, 03:24 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,743 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 21 h 7 m 14 sec
Reputation Power: 62
For updating and deleting, I would transform the data into an XML document object using xmlParse(), loop through it to handle your update or delete, and then save the entire thing back out as an XML file after you're finished.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old July 23rd, 2006, 12:32 PM
Caden Caden is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 273 Caden User rank is Private First Class (20 - 50 Reputation Level)Caden User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 7 h 19 m 28 sec
Reputation Power: 4
Ahh, I was always getting my head stuck thinking "you're updating the structure, not the file how does that work"

But if I write the entire thing again to the file, then that should do it. I'll give it a shot, thanks.

Reply With Quote
  #4  
Old July 23rd, 2006, 05:01 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,743 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 21 h 7 m 14 sec
Reputation Power: 62
Also at this point it might be wise to ask yourself if this data would be better handled within a relational database instead of XML. XML is great for configuration information or information that must be human readable and editable, but for actual data storage a database is much more applicable.

Reply With Quote
  #5  
Old July 23rd, 2006, 06:33 PM
Caden Caden is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 273 Caden User rank is Private First Class (20 - 50 Reputation Level)Caden User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 7 h 19 m 28 sec
Reputation Power: 4
I agree with you certainly, this is more just to learn how to deal with XML files, not for any practical reason, I would use a SQL Database way before I'd have even thought of this.

Still trying to get deleting working, updating works, but slightly different then how I think it "should" be.

I pull the data, put it into a query and then doing selects on it, update via a form, and write to the file.

I am trying to pull the data into a struct for a delete, but I can't seem to get it, can't find a good example...grrr.

Reply With Quote
  #6  
Old July 23rd, 2006, 10:41 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,743 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 21 h 7 m 14 sec
Reputation Power: 62
If you just dump the XML document object you should see your data in an array and structure-like syntax. That should help you figure out how to delete an element.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Updating and Deleting from XML


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT