0.0
No commit activity in last 3 years
No release in over 3 years
The polyrex-schema gem creates Polyrex XML from an initial shorthand schematic string.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.5, >= 1.5.7
~> 1.0, >= 1.0.2
 Project Readme

Introducing the polyrex-schema gem

The polyrex-schema gem builds a Polyrex document from a string representation of the schema.

installation

gem install polyrex-schema

example

require 'polyrex-schema'

o = PolyrexSchema.new 'config/entry[name]/extension[string]/instruction[line,command]'
o.to_s

output:

<root>
  <config>
    <summary/>
    <records>
      <entry>
        <summary><name/></summary>
        <records>
          <extension>
            <summary><string/></summary>
            <records>
              <instruction>
                <summary><line/><command/></summary>
                <records/>
              </instruction>
            </records>
          </extension>
        </records>
      </entry>
    </records>
  </config>
</root>

Polyrex-schema version 0.3

Polyrex-schema version 3.0 can now handle a schema that contain siblings recursively e.g.

require 'polyrex-schema'



o = PolyrexSchema.new 'a/{c[name,count];c2[age]/{f[title];f2[colour]}}/d[title]'

puts o.to_doc.xml pretty: true

output:

  
    polyrex
    a/{c[name,count];c2[age]/{f[title];f2[colour]}}/d[title]
  
  
    
      
        
        
        c[name,count]/d[title]
        [!name] [!count]
      
      
        
          
            <title></title>
            d[title]
            [!title]
          
          
        
      
    
    
      
        
        c2[age]/{f[title];f2[colour]}/d[title]
        [!age]
      
      
        
          
            <title></title>
            f[title]/d[title]
            [!title]
          
          
            
              
                <title></title>
                d[title]
                [!title]
              
              
            
          
        
        
          
            
            f2[colour]/d[title]
            [!colour]
          
          
            
              
                <title></title>
                d[title]
                [!title]
              
              
            
          
        
      
    
  

Resources: