Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,261 Programmers. There are 1,913 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

xml inside an xml document

 
Reply to this topicStart new topic

xml inside an xml document, embedded xml

spullen
post 8 Jun, 2007 - 03:46 PM
Post #1


D.I.C Regular

Group Icon
Joined: 22 Mar, 2007
Posts: 330



OK, so I have this little problem with creating an xml document.
I am overiding the to_xml method inside a model that I have, and it looks like this:
CODE

class Model < ActiveRecord::Base
#database definitions, and table relationships

def to_xml
   xml = Builder::XmlMarkup.new(:indent => 2)
   xml.instruct!
   xml.details do
        xml.tag!(:name,  self.name)# where self calls the data in the column of a database (this works fine), and :name is the name of the column
        xml.tag!(:street, self.street.to_xml) # this is where is gets caught up * (references a table that is foreign to the table of Model, which is another model (obviously))
   end
end
end

*: this is how I was trying to do it, and for the most part it works, except it just takes the xml doc generated and makes it into a string and puts it into the node details, so when I want to parse it, it won't work.

So I guess my question is there a way to insert nodes from another model's table that is joined to the table of the model (set up using belongs_to method)?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 10:19AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month