Skip to content

css4j/web-apis

Repository files navigation

Web APIs

This repository contains Java bindings of Web APIs that are used by Carte/CSS4J projects.


Why the Web APIs project?

EchoSVG is a fork of Apache Batik, an SVG toolkit in the Java language. Both projects require Java bindings based on old versions of the SVG and SMIL DOM APIs.

Apache Batik uses the xml-apis-ext-1.3.04.jar package, which is unsuitable for modular Java due to the fact that it also contains the SAC package which is found in other packages.

This project offers separate packages for SVGOM and SMIL which aren't the exact ones shipped by xml-apis-ext-1.3.04 but are compatible with both EchoSVG and Batik.

The code is based on old Java bindings downloaded from the W3C, and several method signatures had to be modified so they matched the implementations in EchoSVG/Batik. Although it would have been easy to upgrade EchoSVG instead, that would have created problems in cases where both xml-apis-ext-1.3.04.jar and svgom-api or smil-api were found in the classpath or modulepath (which is conceivable if, for example, somebody is using EchoSVG and Apache FOP in the same project).


Building from source

Requirements

To build web-apis you need the following software installed:

  • The Git version control system is required to obtain the sources. Any recent version should suffice.

  • Java 11 or later. You can install it from your favourite package manager or by downloading from Adoptium.


Building with Gradle

Execute the build script with gradlew build to build. For example:

git clone https://github.com/css4j/web-apis.git
cd web-apis
./gradlew build

or just gradlew build (without the ./) on a Windows command prompt.


Deploying to a Maven repository

Use:

  • gradlew build publishToMavenLocal to install in your local Maven repository.

  • gradlew publish to deploy to a (generally remote) Maven repository.

Before deploying to a remote Maven repository, please read the publishing.repositories.maven block of web-apis.java-conventions.gradle to learn which properties you need to set (like mavenReleaseRepoUrlor mavenRepoUsername), either at the command line (-P option) or your GRADLE_USER_HOME/gradle.properties file.


Usage from a Gradle project

If your Gradle project depends on any of the web-apis modules, you can use this project's own Maven repository in a repositories section of your build file:

repositories {
    maven {
        url "https://css4j.github.io/maven/"
        mavenContent {
            releasesOnly()
        }
        content {
            includeGroup 'io.sf.carte'
        }
    }
}

please use that repository only for the artifact groups that it supplies.

Then, in your build.gradle file you can list the dependencies, for example:

dependencies {
    api 'io.sf.carte:svgom-api:1.0.1'
}

If you use the packages provided by this project, you may need to exclude the xml-apis-ext dependency in you Gradle or Maven build, for example:

dependencies {
    api ('io.sf.carte:svgom-api:1.0.1') {
        exclude group: 'xml-apis', module: 'xml-apis-ext'
    }
}

Licensing

The source files and derived works are available under the "W3C Software and Document Notice and License". Please read the LICENSE.txt file for details.