On Mon, Apr 23, 2007 at 03:20:09PM -0000, Eric Mill wrote:
> 
> > Okay.  I see that my first patch was committed this morning (thanks
> > DHH) so this is the next logical step.  Note that by itself, this
> > change enables nothing without a proper schema definition.  Basically
> > it would be trading a little bit of aesthetics (e.g., datetime for
> > dateTime) for a little bit of purity (a "standard" type list).
> 
> Could you elaborate here a bit and list the changes needed to the
> current AR::to_xml method to make it W3C compliant?  This sounds like
> a good idea, though I'm curious as to how heavy the aesthetics-
> standards tradeoff will be.

Well the changes needed to mirror the standard are simply

1. change datetime to dateTime
2. change float to double
3. change encoding="binary" to type="base64Binary"

On top of this, you might consider adding an explicit type="string".
Making these changes would not bring any sort of compliance, though,
as they types are usually indicated in a separte schema file, not
inline.

> > On the subject of XML schemas, the biggest missing piece of the puzzle
> > is a way to get the appropriate attributes on the root element for
> > records.  I am thinking an interface would look something like
> > 
> > @people.to_xml(
> >   :root_attributes => {
> >     'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance";,
> >     'xsi:noNamespaceSchemaLocation' => formatted_people_url(:xsd)
> >   }
> > )
> 
> Could this be even simpler?  And, assuming the schema is at /people/
> new.xml:
> 
>   @people.to_xml(:format => :w3c, :schema => new_person_url(:format
> => :xml))
> 
> And maybe, to address Michael's concern, we could support both a
> simple and a RelaxNG format for model schemas:

Sure, there are many ways it could be done.  The interface I discuss
is the bare minimum necessary to play with this sort of thing without
monkey patching several rather large #to_xml methods.  Support for
multiple schema formats isn't something that belongs in the core, at
least not without spending a lot of time in plugin land first.

Cheers,
Tim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to