Lionel Cons


Config::Generator::XML - Config::Generator XML support


This module eases XML content generation by providing several functions to generate XML abstractions (xml_blank(), xml_comment(), xml_element(), xml_parse() and xml_wrap()) and one function to convert these abstractions into strings (xml_string()).

Note: only a subset of XML (without any text) is supported. This means that this module is not suited for HTML generation.


This module provides the following functions (none of them being exported by default):


return an XML abstraction representing a blank line


return an XML abstraction representing a comment

xml_element(NAME[, ATTR[, BODY]])

return an XML abstraction representing an element:

  • ATTR: defines the attributes as a hash or array reference

  • BODY: defines the body as a list of XML abstractions


parse the given string (that must contain well formed XML) and return the list of XML abstractions it contains

xml_string(ELEMENT[, OPTIONS])

return the string representation of the given XML abstraction; supported options:

  • indent: how many spaces to prepend to each line (default: 0)

  • line: maximum line length (longer lines will be wrapped)

  • sort: which elements to have their attributes sorted differently, as a hash: name => sorting function

  • split: which elements to split (i.e. to have their attributes split on different lines), as a hash: name => boolean


wrap the given XML elements into nested elements of the given names (with no attributes)


Lionel Cons

Copyright (C) CERN 2013-2014