NAME

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

DESCRIPTION

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.

FUNCTIONS

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

xml_blank()

return an XML abstraction representing a blank line

xml_comment(STRING)

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

xml_parse(STRING)

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

xml_wrap(NAMES, ELEMENTS)

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

AUTHOR

Lionel Cons http://cern.ch/lionel.cons

Copyright (C) CERN 2013-2014