How to factorize common tags with nokogiri builder ?

Posted by plafoucriere on Stack Overflow See other posts from Stack Overflow or by plafoucriere
Published on 2010-05-13T23:04:48Z Indexed on 2010/05/13 23:44 UTC
Read the original article Hit count: 158

Filed under:
|
|

Hi,

I'd like to create several builders, with common tags, in order to have xml docs like :

  <xml version="1.0"?>
    <a_kind_of_root>
      <!-- This part is common -->
      <event_date>20100514</event_date>
      <event_id>123</event_id>
      <event_type>Conference</event_type>
      <!-- This part is specific to the builder -->
      <my_tag>some text</my_tag>
    </a_kind_of_root>
  </xml>

  <xml version="1.0"?>
    <another_kind_of_root>
      <!-- This part is common -->
      <event_date>20100514</event_date>
      <event_id>123</event_id>
      <event_type>Conference</event_type>
      <!-- This part is specific to the builder -->
      <my_other_tag>some integer</my_other_tag>
    </another_kind_of_root>
  </xml>

I don't know how to put the common part inside a Nokogiri::XML::Builder

Thanks

© Stack Overflow or respective owner

Related posts about nokogiri

Related posts about ruby