Skip to content

Commit

Permalink
update to latest xmlresolver
Browse files Browse the repository at this point in the history
in hope that it fixes windows issue...
  • Loading branch information
pahjbo committed Feb 8, 2024
1 parent 90aaffc commit 9213c1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions tools/gradletooling/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ dependencies {

implementation("net.sf.saxon:Saxon-HE:10.8") // for xslt 3.0
implementation("name.dmaus.schxslt:java:3.1.1") // for modern schematron
implementation("org.xmlresolver:xmlresolver:5.2.3") // for xml catalogues - note that the apache xml-commons resolver is out of date
implementation("name.dmaus.schxslt:schxslt:1.9.5") // force to use more updated schematron than the java wrapper naturally uses -
implementation("org.xmlresolver:xmlresolver:6.0.4") // for xml catalogues - note that the apache xml-commons resolver is out of date
implementation("org.javastro.vodsl:vodslparser:0.4.6") //standalone vodsl parser
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2")

Expand Down Expand Up @@ -102,7 +103,7 @@ val functionalTest by tasks.registering(Test::class) {
tasks.withType<Test>().configureEach {
useJUnitPlatform()
systemProperty("GRADLE_ROOT_FOLDER", projectDir.absolutePath)
systemProperty("GRADLE_BUILD_FOLDER", layout.buildDirectory)
systemProperty("GRADLE_BUILD_FOLDER", layout.buildDirectory.asFile.get().absolutePath)
systemProperty("GRADLE_PLUGIN_VERSION", version)
testLogging {
showStandardStreams = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package net.ivoa.vodml.gradle.plugin

import name.dmaus.schxslt.Schematron
import org.gradle.api.DefaultTask
import org.gradle.api.file.ArchiveOperations
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.*
import org.xmlresolver.CatalogResolver
import org.xmlresolver.XMLResolver
import org.xmlresolver.ResolverFeature
import org.xmlresolver.XMLResolverConfiguration
import javax.inject.Inject
Expand Down Expand Up @@ -41,10 +38,10 @@ import javax.xml.transform.stream.StreamSource
config.setFeature(ResolverFeature.PREFER_PUBLIC, false)

config.setFeature(ResolverFeature.URI_FOR_SYSTEM, true) // fall through to URI
val catalogResolver = CatalogResolver(config)
val resolver = XMLResolver(config)

val transformerFactory = net.sf.saxon.TransformerFactoryImpl()
transformerFactory.uriResolver = org.xmlresolver.Resolver(catalogResolver)
transformerFactory.uriResolver = resolver.getURIResolver()

val schematron = Schematron(StreamSource(this::class.java.getResourceAsStream("/xslt/vo-dml-v1.0.sch.xml")), null,
transformerFactory, HashMap())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import net.sf.saxon.s9api.Serializer
import net.sf.saxon.s9api.XdmAtomicValue
import org.gradle.api.GradleException
import org.slf4j.LoggerFactory
import org.xmlresolver.CatalogResolver
import org.xmlresolver.XMLResolver
import org.xmlresolver.ResolverFeature
import org.xmlresolver.XMLResolverConfiguration
import java.io.File
Expand Down Expand Up @@ -73,8 +73,8 @@ import javax.xml.transform.stream.StreamSource
config.setFeature(ResolverFeature.CATALOG_FILES, listOf(catalog.absolutePath ))
}
config.setFeature(ResolverFeature.URI_FOR_SYSTEM, false) // don't automatically use URI as system to prevent surprises
val catalogResolver = CatalogResolver(config)
trans.uriResolver = org.xmlresolver.Resolver(catalogResolver)
val resolver = XMLResolver(config)
trans.uriResolver = resolver.getURIResolver()
trans.transform(StreamSource(vodmlFile), out)
}

Expand Down

0 comments on commit 9213c1e

Please sign in to comment.