I must confess I’ve been learning to love XML, but it hasn’t been
always like this.
When I’ve first seen it, I thought it was a cool idea, but it didn’t
seem like it could achieve a practical value for me. After all, at
that time I was a VB programmer, and my concept of useful was dragging
buttons to draw forms and use Access for databases wink.
But time has passed, and I started to hear more and more about this
beast. Particularly since I’ve met Paul, which I think from the
persons that I talk to regularly, is the one who believes more than
anyone in XMLTopia, a world where all applications will be able to
interchange information using XML.
I fear though, that I may have joined the wave way too late. Now
that I’m starting to effectively use XML, I see more and more starting
to use RDF in practice. Yes, RDF can be serialized to and from
XML. However it seems like this serialization can occur in several
different ways, and still keep the same semantic value.
I’ve been working hard to try to make some sense out of the semantic
web, specially since it seems to be gaining speed amongst some
developers that I know. However, I must confess that it melts my brain
to try to follow their conversations. I’ve spent a couple hours
chatting with Joe ‘Arnia’ Geldart and it took me a full 3 days to
digest just about 5% of the information he gave me :)
Anyway, as I’ve said already, the situation is improving on my
end. I’ve spent most of the last two weeks on building a import/export
framework for Archetypes-based products. There’s a good summary about
it on PLIP44, which btw, I should update to reflect some of the
changes I’ve done to the xml dialect and schema.
To finish, it has been a pleasant time working on this. Much more
pleasant than I would expect, and I really hope more and more people
start drinking the XML kool-aid so we can meet all in XMLTopia one day!
Yaml Alternative
I’ve been experimenting with PyYaml and Archetypes. Here is some sample output you may be interested in…. (more info on yaml <a href="http://blog.99hats.com/58">here</a>)
<pre>
CODE:
import yaml
return yaml.d(self.Schema().fields())
OUTPUT:
—
– !!Products.Archetypes.Field.StringField
__name__: id
_layers:
storage: !!Products.Archetypes.Storage.AttributeStorage {}
accessor: getId
default: ~
default_content_type: text/plain
default_method: ~
edit_accessor: getRawId
enforceVocabulary: 0
force: ”
generateMode: veVc
index: ~
isMetadata: 0
languageIndependent: False
mode: rw
multiValued: 0
mutator: setId
read_permission: View
required: 0
schemata: default
searchable: 0
storage: !!Products.Archetypes.Storage.AttributeStorage {}
type: string
validators:
handlers: []
strategy: and
vocabulary: []
widget: !!Products.Archetypes.Widget.IdWidget
_processed: 0
condition: ”
description: Should not contain spaces, underscores or mixed case. Short Name is part of the item’s web address.
description_msgid: help_shortname
display_autogenerated: 1
helper_css: []
helper_js: []
i18n_domain: plone
is_autogenerated: isIDAutoGenerated
label: Short Name
label_msgid: label_short_name
macro: widgets/zid
modes:
– view
– edit
populate: 1
postback: 1
show_content_type: 0
visible:
view: invisible
write_permission: Modify portal content
– !!Products.Archetypes.Field.StringField
__name__: title
_layers:
storage: !!Products.Archetypes.Storage.AttributeStorage {}
accessor: Title
default: ”
default_content_type: text/plain
default_method: ~
edit_accessor: getRawTitle
enforceVocabulary: 0
force: ”
generateMode: veVc
index: ~
isMetadata: 0
languageIndependent: False
mode: rw
multiValued: 0
mutator: setTitle
read_permission: View
required: 1
schemata: default
searchable: 1
storage: !!Products.Archetypes.Storage.AttributeStorage {}
type: string
validators:
handlers: []
strategy: and
vocabulary: []
widget: !!Products.Archetypes.Widget.StringWidget
_processed: 0
condition: ”
description: ”
helper_css: []
helper_js: []
i18n_domain: plone
label: Title
label_msgid: label_title
macro: widgets/string
maxlength: ‘255’
modes:
– view
– edit
populate: 1
postback: 1
show_content_type: 0
size: ’30’
visible:
edit: visible
view: visible
write_permission: Modify portal content
– !!Products.Archetypes.Field.StringField
__name__: allowDiscussion
_layers:
storage: !!Products.Archetypes.Storage.MetadataStorage {}
accessor: isDiscussable
default: ~
default_content_type: text/plain
default_method: ~
edit_accessor: getRawAllowDiscussion
enforceVocabulary: 1
force: ”
generateMode: mVc
index: ~
isMetadata: 1
languageIndependent: False
mode: rw
multiValued: 0
mutator: allowDiscussion
read_permission: View
required: 0
schemata: metadata
searchable: 0
storage: !!Products.Archetypes.Storage.MetadataStorage {}
type: string
validators:
handlers: []
strategy: and
vocabulary: !!Products.Archetypes.utils.DisplayList
_i18n_msgids: {}
_itor:
– 0
– 1
– ~
_keys:
None:
– 3
– Default
0:
– 1
– Disabled
1:
– 2
– Enabled
_values:
Default:
– 3
– ~
Disabled:
– 1
– 0
Enabled:
– 2
– 1
index: 3
widget: !!Products.Archetypes.Widget.SelectionWidget
_processed: 0
condition: ”
description: ”
description_msgid: help_allow_discussion
format: flex
helper_css: []
helper_js: []
i18n_domain: plone
label: Allow Discussion?
label_msgid: label_allow_discussion
macro: widgets/selection
modes:
– view
– edit
populate: 1
postback: 1
show_content_type: 0
visible:
edit: visible
view: visible
write_permission: Modify portal content
– !!Products.Archetypes.Field.LinesField
__name__: subject
_layers:
storage: !!Products.Archetypes.Storage.MetadataStorage {}
accessor: Subject
default: []
default_method: ~
edit_accessor: getRawSubject
enforceVocabulary: 0
force: ”
generateMode: mVc
index: ~
isMetadata: 1
languageIndependent: False
mode: rw
multiValued: 1
mutator: setSubject
read_permission: View
required: 0
schemata: metadata
searchable: 0
storage: !!Products.Archetypes.Storage.MetadataStorage {}
type: lines
validators:
handlers: []
strategy: and
vocabulary: []
widget: !!Products.Archetypes.Widget.KeywordWidget
_processed: 0
condition: ”
description: ”
description_msgid: help_keyword
helper_css: []
helper_js: []
i18n_domain: plone
label: Keywords
label_msgid: label_keywords
macro: widgets/keyword
modes:
– view
– edit
populate: 1
postback: 1
roleBasedAdd: 1
show_content_type: 0
size: 5
visible:
edit: visible
view: visible
vocab_source: portal_catalog
write_permission: Modify portal content
…
</pre>