webgen logo

webgen / static website generator

static website generation made easy!

Sub Menu

Tips

  • The basics pagecontains everything one needs to get going with webgen!
  • Descriptions for plugins can be found in the plugins section

Latest news

2007-12-31: Minor release with feature enhancements. More...

2007-09-08: Small bug fix release. More...

2007-06-29: Some bug fixes and one small feature enhancement. More...

Links

Generated by webgen

General Information

Plugin name:ContentConverter/XmlBuilder (ContentConverter/Default)
Author:Thomas Leitner <t_leitner@gmx.at>
Summary:Handles content structured using the XML Builder library
Handler name:xmlbuilder

Description

This plugin can be used to programatically create XHTML/XML documents (Reference). The top builder object is provided through the xml object.

Examples

Following is a short example on how to use this plugin in a page file which generates a custom XML document (the block has to be valid Ruby!):

---
outputNameStyle: [:name, ['.', :lang], '.xml']
title: Person Object
--- content, xmlbuilder
xml.persons do |p|
  xml.person do |b|
    b.firstname('Thomas')
    b.lastname('Leitner')
  end
  xml.person do |b|
    b.firstname('Other first')
    b.lastname('Other last')
  end
end

The above will produce the following output:

<persons>
  <person>
    <firstname>Thomas</firstname>
    <lastname>Leitner</lastname>
  </person>
  <person>
    <firstname>Other first</firstname>
    <lastname>Other last</lastname>
  </person>
</persons>

Caveat

This plugin is only available if you have installed the builder library. The preferred way to do this is via Rubygems:

gem install builder