add elements

This commit is contained in:
Jörg Prante 2021-12-06 18:36:23 +01:00
parent 86c1f6ed9d
commit c36adfa79b
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,25 @@
package org.xbib.graphics.pdfbox.layout.test.script;
import org.junit.jupiter.api.Test;
import org.xbib.settings.Settings;
import java.util.logging.Logger;
public class ElementsTest {
@Test
public void script() throws Exception {
Settings settings = Settings.settingsBuilder()
.loadFromResource("json", getClass().getResourceAsStream("elements.json"))
.build();
Logger.getAnonymousLogger().info(settings.getAsMap().toString());
Logger.getAnonymousLogger().info(String.valueOf(settings.containsSetting("elements")));
Logger.getAnonymousLogger().info(String.valueOf(settings.containsSetting("elements.0")));
Logger.getAnonymousLogger().info(String.valueOf(settings.containsSetting("elements.1")));
Logger.getAnonymousLogger().info(String.valueOf(settings.containsSetting("elements.2")));
Logger.getAnonymousLogger().info(settings.getAsSettings("elements").getAsMap().toString());
Logger.getAnonymousLogger().info(settings.getAsSettings("elements.0").getAsMap().toString());
Logger.getAnonymousLogger().info(settings.getAsSettings("elements.1").getAsMap().toString());
Logger.getAnonymousLogger().info(settings.getAsSettings("elements.2").getAsMap().toString());
}
}

View file

@ -0,0 +1,21 @@
{
"type": "document",
"elements": [
{
"type": "paragraph",
"elements": [
{
"type": "text",
"value": "Hello World 1"
}
]
},
{
"type": "paragraph",
"elements": {
"type": "text",
"value": "Hello World 2"
}
}
]
}