Skip to content

koara/koara-java-xml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koara

Build Status Coverage Status ![Latest Version](https://img.shields.io/maven-central/v/com.codeaddslife.koara/koara-xml.svg?label=Maven Central) License

Koara-java-xml

Koara is a modular lightweight markup language. This project can render the koara AST to Xml in Java.
The AST is created by the core koara parser.

Getting started

  • Download JAR file

  • Gradle

    dependencies {
      compile "com.codeaddslife.koara:koara-xml:0.15.0"
    }
  • Maven

    <dependency>
      <groupId>com.codeaddslife.koara</groupId>
      <artifactId>koara-xml</artifactId>
      <version>0.15.0</version>
    </dependency>

Usage

package demo;

import com.codeaddslife.koara.Parser;
import com.codeaddslife.koara.ast.Document;
import XmlRenderer;

public class App {

	public static void main(String[] args) {
		Parser parser = new Parser();
		Document result = parser.parse("Hello World!");
		XmlRenderer renderer = new XmlRenderer();
		result.accept(renderer);
		System.out.println(renderer.getOutput());
	}
	
}

Configuration

You can configure the Renderer:

  • parser.setHardWrap(boolean hardWrap)
    Default: false

    Specify if newlines should be hard-wrapped (return-based linebreaks) by default.

  • renderer.setDeclarationTag(String declarationTag)
    Default: null

    Add an XML Declaration Tag add the top of the generated output.