Skip to content

Instantly share code, notes, and snippets.

@ionas
Created September 23, 2010 17:09
Show Gist options
  • Save ionas/593997 to your computer and use it in GitHub Desktop.
Save ionas/593997 to your computer and use it in GitHub Desktop.
Element HasOneToMany Blocks
Block HasOne Element OR HasOne Data
Element AlwaysBelongsTo Definition
Definition HasZeroToMany Elements
Element AlwaysBelongsTo Transformation
Transformation HasZeroToMany Elements
####################
Definition Examples:
####################
Fields:
- uuid
- label (unique)
- description
- xmlschema (relaxng)
http://www.devarticles.com/c/a/XML/An-Introduction-to-RELAX-NG/2/
1. Specify element type definitions in Relax NG
2. Generate Forms+Validations from these Definitions
3. Make those Forms to be drag+dropable
########################
Transformation Examples:
########################
Fields:
- name (unique)
- transformation engine (xsl, nokogiri, custom tailored ERB/Ruby...)
- transformation code (RelaxNG, XML Schema is overkill)
Use ERB/Ruby or XSLT to Transform an Element.
Whenever <reference> is called, this one is used.
<reference> can also hold <http> instead of <element_uuid> to specify a resource
Probably a reference could take a <cache> key which would mean the database would store a cache for
#################
Element Examples:
#################
Fields
- uuid
- label
- xmldata
- as fields or assocs: versions, stages, dates, publishing information, translations, whatever...
<!-- An Image Element -->
<element>
<uuid>550e8400-e29b-41d4-a716-446655440001</uuid>
<definition_id>an_image_with_a_caption</definition_id>
<label>The Google Logo Image with Caption</label>
<block>
<data>
<image>
<source>google.gif</source>
</image>
</data>
</block>
<block>
<data>
<caption>
<primary>The Google Logo</priamry>
<secondary>(c) by Google Inc.</secondary>
</caption>
</data>
</block>
</element>
<!-- A Text-Paragraph Element -->
<element>
<uuid>550e8400-e29b-41d4-a716-446655440002</uuid>
<definition_id>a_paragraph</definition_id>
<label>A Lorem Ipsum paragraph</label>
<block>
<data>
<paragraph>
Lorem Ipsum...
</paragraph>
</data>
</block>
</element>
<!-- Paragraph-With-Image (Combined Element) -->
<element>
<uuid>550e8400-e29b-41d4-a716-446655440003</uuid>
<definition_id>two_horizontal_images</definition_id>
<label>Two horizontal elements, in this case references to Google Image and a Text</label>
<block>
<reference>
<!-- The Paragraph -->
<element_uuid>550e8400-e29b-41d4-a716-446655440002</element_uuid>
</reference>
</block>
<block>
<reference>
<!-- The Google Image -->
<element_uuid>550e8400-e29b-41d4-a716-446655440001</element_uuid>
</reference>
</block>
</element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment