TreeInfo from Source?

Martynas Jusevičius <martynas-tyFqBaoSXPC1Z/[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <CAE35VmzLv9kG=VOaE1kkcmVOWJNXn6=vUGQ6r5T4854D5y27LA@mail.gmail.com>
Hi,

I want to use the "Preloading shared reference documents" feature with
Saxon-HE 10.1:
http://saxonica.com/html/documentation/sourcedocs/preloading.html

More specifically, call config.getGlobalDocumentPool().add(doc, uri)
in order to avoid resolving the same document URIs again and again
during multiple transformations.

Looking at the add() method I see it accepts a TreeInfo. Our code is
operating on Sources. Although TreeInfo extends Source, I cannot find
how it is constructed from one. None of the wrapper classes accept it.
Where should I look?

That is how we currently build Source instances:

        try (ByteArrayOutputStream stream = new ByteArrayOutputStream())
        {
            model.write(stream);
            return new StreamSource(new
ByteArrayInputStream(stream.toByteArray()), systemId);
        }


Martynas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.