Today we are pleased to release version 1.1.1 of xml2. xml2 makes it easy to read, create, and modify XML with R. You can install it with:
|
|
As well as fixing many bugs, this release:
-
Makes it easier to create an modify XML
-
Improves roundtrip support between XML and lists
-
Adds support for XML validation and XSLT transformations.
You can see a full list of changes in the release notes . This is the first release maintained by Jim Hester .
Creating and modifying XML#
xml2 has been overhauled with a set of methods to make generating and modfying XML easier:
xml_new_root()can be used to create a new document and root node simultaneously.
|
|
- New
xml_set_text(),xml_set_name(),xml_set_attr(), andxml_set_attrs()make it easy to modify nodes within a pipeline.
|
|
-
New
xml_add_parent()makes it easy to insert a node as the parent of an existing node. -
You can create more esoteric node types with
xml_comment()(comments),xml_cdata()(CDATA nodes), andxml_dtd()(DTDs).
Coercion to and from R Lists#
xml2 1.1.1 improves support for converting to and from R lists, thanks in part to work by Peter Foley
and Jenny Bryan
. In particular xml2 now supports preserving the root node name as well as saving all xml2 attributes as R attributes. These changes allows you to convert most XML documents to and from R lists with as_list() and as_xml_document() without loss of data.
|
|
XML validation and xslt#
xml2 1.1.1 also adds support for XML validation, thanks to Jeroen Ooms
. Simply read the document and schema files and call xml_validate().
|
|
Jeroen also released the first xml2 extension package in conjunction with xml2 1.1.1, xslt . xslt allows one to apply XSLT (Extensible Stylesheet Language Transformations) to XML documents, which are great for transforming XML data into other formats such as HTML.
