Svg Builder

JAXB Classes for SVG

License

License

GroupId

GroupId

com.github.rahulsom
ArtifactId

ArtifactId

svg-builder
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

Svg Builder
JAXB Classes for SVG
Project URL

Project URL

https://github.com/rahulsom/svg-builder
Source Code Management

Source Code Management

https://github.com/rahulsom/svg-builder

Download svg-builder

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.rahulsom/svg-builder/ -->
<dependency>
    <groupId>com.github.rahulsom</groupId>
    <artifactId>svg-builder</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.rahulsom/svg-builder/
implementation 'com.github.rahulsom:svg-builder:0.3.1'
// https://jarcasting.com/artifacts/com.github.rahulsom/svg-builder/
implementation ("com.github.rahulsom:svg-builder:0.3.1")
'com.github.rahulsom:svg-builder:jar:0.3.1'
<dependency org="com.github.rahulsom" name="svg-builder" rev="0.3.1">
  <artifact name="svg-builder" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.rahulsom', module='svg-builder', version='0.3.1')
)
libraryDependencies += "com.github.rahulsom" % "svg-builder" % "0.3.1"
[com.github.rahulsom/svg-builder "0.3.1"]

Dependencies

test (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.30
org.spockframework : spock-core jar 1.3-groovy-2.5

Project Modules

There are no modules declared in this project.

License MavenCentral

SVG Builder

JAXB Classes for SVG.

Usage

In Java code, the fluent API can be used to build SVG

ObjectFactory objectFactory = new ObjectFactory();
Svg svg = objectFactory.createSvg().withHeight("3").withWidth("7").
        withSVGDescriptionClassOrSVGAnimationClassOrSVGStructureClass(
                objectFactory.createCircle(
                        objectFactory.createCircle()
                ),
                objectFactory.createA(
                        objectFactory.createSVGHyperlinkClass()
                )
        );

In Groovy code, the same can be done. Alternately a simpler DSL can be used.

@NewifySvg
void foo() {
    def svg =
        Svg(height: '3', width: '7').content {
            it << Circle()
            it << SVGHyperlinkClass()
        }
}

Similarly, in Kotlin you could do this

val svg = Svg().withHeight("3").withWidth("7")
    .content {
        add(Circle())
        add(SVGHyperlinkClass())
    }

The resulting object is like any JAXB Root Element and can be marshaled from that point on.

Versions

Version
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0