This project is archived and is in readonly mode.
model.to_xml does not generate all type attributes
-
Frederick Cheung
What where you expecting ? and ?
-
Conrad Taylor
I was expecting to see the following for the name and description elements:
<people><person> <description type="text" >This is a test</description> ... <name type="string">Conrad</name> </person><description type="text">This is yet another test 2.</description> ... <name type="string">Conrad</name> -
Frederick Cheung
They're both just plain text data. the type atribute isn't supposed to replicate the database schema, ie you see integer not bigint(12) so that whatever is reading the xml knows how to interpret the plain text content. In the case where the content is just plain text we don't need to say anything.
-
Conrad Taylor
OK, why do we have some type attributes for some elements and no type attributes for others? Next, the generated XML appears to simply display what's contained in the schema.rb file. The :skip_type option is set to false by default from reading the documentation. In any case, I was thinking about using this generated XML file with it's type attribute to populate a Gemstone/S database.
-
Frederick Cheung
I believe the only type without attributes are the ones which are purely textual in nature (and if you look at the source this is quite deliberate). I know nothing about gemstone/S but when loading a record does it really care about whether the value came from a text column or a varchar column ?
-
Conrad Taylor
Why even define the type attribute when generating XML? The type of an XML field can be determined or selected from an XML Schema.
-
Frederick Cheung
That's why skip_types is there I suppose. On the other why not be helpful when there is no xsd / client doesn't support xsd/ you can't be bother with an xsd.
-
Conrad Taylor
OK, that's fair enough.