Hi Is it a good idea to keep for example blog posts in xml file rather than mysql? Right now i am trying this kind of project and its going really really slow, i dont have a model, i learn REXML, but still cant add nothing to my xml from a form for example. Anyway..is this a good way? or You would suggest database? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pabloz wrote:> Is it a good idea to keep for example blog posts in xml file rather than > mysql? Right now i am trying this kind of project and its going really > really slow, i dont have a model, i learn REXML, but still cant add > nothing to my xml from a form for example. Anyway..is this a good way? > or You would suggest database?Which kind of store do you understand best? And wouldn''t you prefer to have full ActiveRecord support? SQLite3 fully supports arbitrary-length strings in all VARCHARs (whether you want them or not). Now why can''t your form add anything to XML? Could you use Builder::XmlMarkup to write the XML and REXML to read it? Can you create new elements and add them to REXML? is that where you are stuck? Without more info your question is arbitrary. I would use YAML, but we will keep that our little secret... -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In my experience parsing xml files with REXML was much slower than reading from MySQL. I had a storefront that read product data from XML that was dumped from a legacy POS system. Page loads were SLOW. I wound up writing an update script to sync the XML files with a MySQL table and it became much faster. Not to mention the ease of use for CRUD that comes with ActiveRecord. That said, I could''ve probably just cached the XML (as you could too) but in my case I wasn''t writing to XML, just reading. Also creating a model that houses the logic for CRUD/returning attributes, would probably make you much happier, and your app more rails like. that way if you ever decide to switch to db later, it will be much easier. But if you''re building from scratch, I''d just go with MySQL (or other DB). -- Chris Martin Web Developer Open Source & Web Standards Advocate http://www.chriscodes.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pabloz wrote:> Hi > > Is it a good idea to keep for example blog posts in xml file rather than > mysql? Right now i am trying this kind of project and its going really > really slow, i dont have a model, i learn REXML, but still cant add > nothing to my xml from a form for example. Anyway..is this a good way? > or You would suggest database?You can think of a basic xml file as a database with far less features and flexibility. Why not go with a database? Rails make it dead simple to do so. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28-Nov-06, at 2:23 PM, Pabloz wrote:> > Hi > > Is it a good idea to keep for example blog posts in xml file rather > than > mysql? Right now i am trying this kind of project and its going really > really slow, i dont have a model, i learn REXML, but still cant add > nothing to my xml from a form for example. Anyway..is this a good > way? > or You would suggest database?I think there are very good reasons to keep your data in the file system, and I do this routinely. However, using the DOM as an in- memory data structure os something that I find painful even to contemplate. If you really want to do this, then you might look at libxml as an alternative (much faster with some nice utilities). You''ve got some alternatives: ActiveRecord, which undeniably fits nicely into Rails, but then you''ve got a database to deal with. YAML which may well be what you are hoping for by using XML (but I''ve experienced some problems with it). There is also JSON and a more Ruby-like variant called Ron. With JSON/Ron and YAML you won''t have control over the appearance of the file on disk, control that you would have with XML, and that might be a problem -- but you''ll have a much nicer programming model. A final alternative for XML is to use something like xampl (I''m biased, see the links below). This gives you some reasonable control over the on-disk appearance and a *much* easier API to manipulate the XML in your program (the API is just Ruby). I don''t know if I''d start something new with the current version of xampl, there''s a new version of xampl that I''ll be releasing soon (I hope) that is much improved and works pretty much transparently with Rails (unless you want to use Rail''s scaffolding). The documentation in the examples download is still almost entirely correct, I''ve just added stuff. Good luck. I''d be interested in knowing what you chose to do and how it works out. Cheers, Bob ---- Bob Hutchison -- blogs at <http://www.recursive.ca/ hutch/> Recursive Design Inc. -- <http://www.recursive.ca/> Raconteur -- <http://www.raconteur.info/> xampl for Ruby -- <http://rubyforge.org/projects/xampl/> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pabloz wrote:> Hi > > Is it a good idea to keep for example blog posts in xml file rather than > mysql? Right now i am trying this kind of project and its going really > really slow, i dont have a model, i learn REXML, but still cant add > nothing to my xml from a form for example. Anyway..is this a good way? > or You would suggest database? > > -- > Posted via http://www.ruby-forum.com/.Without knowing the business problem, the question is meaningless. XML is good for cross-platform data transfer and serialization of hierarchical data. DOM can be considered an indexed tree structure, independent of its XML roots, for some purposes. I have used JDOM as the core of a high-performance ETL tool. In this case, the DOM is never rendered as XML except for debugging. I build DOM from COBOL copybooks, VSAM records, RDBMS rows, Excel spreadsheets, and (of course) XML documents. I max out the I/Ochannels on mainframe database server with this configuration. RDBMS is good for data that can be organized as a set of related tables. It has proven itself to be a flexible model for meeting most problems efficiently. Personally, I am not fond of MySQL. The business problems that I work on tend to be transactional, and MySql does not honor the ACID definition of a transaction. However, it does work well as a backing store for for mostly static data (Wikipedia) and data that is not audit sensitive (37signals). On the other hand, with their purchase of Netfrastructure, I believe that MySql is positioned to become a technology leader in the next generation of transactional RDBMS'' in the next two years. I do like Firebird RDBMS, and the ruby support for Firebird is quite decent. You should probably also download and test the personal versions of DB2, MS-SQL, and Oracle if you plan to distribute your application. Perhaps you could give us a better idea of the scope of the problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---