On 19.09.2020 22:54, Andreas Mixich wrote:
Hi,
how can I translate this Java[1] to XQuery according to [2]?
package com.vladsch.flexmark.samples;
import com.vladsch.flexmark.util.ast.Node;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.data.MutableDataSet;
public class BasicSample {
public static void main(String[] args) {
MutableDataSet options = new MutableDataSet();
// uncomment to set optional extensions
//options.set(Parser.EXTENSIONS,
Arrays.asList(TablesExtension.create(), StrikethroughExtension.create()));
// uncomment to convert soft-breaks to hard breaks
//options.set(HtmlRenderer.SOFT_BREAK, "<br />\n");
Parser parser = Parser.builder(options).build();
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
// You can re-use parser and renderer instances
Node document = parser.parse("This is *Sparta*");
String html = renderer.render(document); // "<p>This is
<em>Sparta</em></p>\n"
System.out.println(html);
}
}
I only get so far as to:
declare namespace Node = "com.vladsch.flexmark.util.ast.Node";
declare namespace HtmlRenderer =" com.vladsch.flexmark.html.HtmlRenderer";
declare namespace Parser = "com.vladsch.flexmark.parser.Parser";
declare namespace MutableDataSet =
"com.vladsch.flexmark.util.data.MutableDataSet";
declare option db:checkstrings 'false';
let $mds := MutableDataSet:new()
let $builder := Parser:builder($mds)
return $builder
which results in
DataSet{dataSet={}}
I found no documentation, on how to translate something as
Parser.builder(options).build()
to XQuery. How do I express the method
build()
of the instance
Parser.builder(options)
I just created?
Does
import com.vladsch.flexmark.parser.Parser.Builder;
with
$builder => Parser.Builder:build()
work?