Project

zenml

0.0
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
This gem serves a tool for parsing a document written in ZenML, an alternative new syntax for XML, to an XML node tree. This also contains some utility classes to transform XML documents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Zenithal Markup Language (ZenML)

Overview

Zenithal Markup Language (ZenML) serves an alternative syntax for XML. It is almost fully compatible with XML, and less redundant and more readable than XML.

This repository provides a script for converting ZenML to XML, together with the utility classes which help to transform XML documents.

This library is obsolete and no longer maintained. Use the TypeScript implementation instead.

Installation

Install from RubyGems.

gem install zenml

Syntax

Note that the version of the syntax itself is independent of that of the processor.

Usage

Create a ZenithalParser instance with a ZenML string, and then call parse method. This method returns a REXML::Document instance. If you want an XML string instead of a syntax tree, use formatters of rexml/document library.

The following example code converts a ZenML file to an XML file:

# the parser uses classes offered by rexml/document library
require 'rexml/document'
require 'zenml'
include REXML
include Zenithal
# read a ZenML source from a file
source = File.read("sample.zml")
parser = ZenithalParser.new(source)
File.open("sample.xml", "w") do |file|
  # create a formatter to output the node tree as a string
  formatter = Formatters::Default.new
  document = parser.run
  formatter.write(document, file)
end