Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* <p><b>Example:</b></p>
* <pre>{@code
* // enable XML schema validation, setting the "xerces" property to the schema.xsd file
* dataProcessor.withValidation("xerces", new URL("file:///path/to/schema.xsd"))
* dataProcessor.withValidation("xerces", new URI("file:///path/to/schema.xsd").toURL)
* }</pre>
* </dd>
*
Expand All @@ -92,10 +92,10 @@
* <p><b>Example:</b></p>
* <pre>{@code
* // enable schematron validation, setting the "schematron" property to the schematron.sch file
* dataProcessor.withValidation("schematron", new URL("file:///path/to/schematron.sch"))
* dataProcessor.withValidation("schematron", new URI("file:///path/to/schematron.sch").toURL)
*
* // use schematron validation, reading the schematron.properties file to set "schematron" or other schematron properties
* dataProcessor.withValidation("schematron", new URL("file:///path/to/schematron.properties"))
* dataProcessor.withValidation("schematron", new URI("file:///path/to/schematron.properties").toURL)
* }</pre>
* </dd>
* </dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.daffodil.validation

import java.io.IOException
import java.net.URI
import java.net.URL
import java.util.Properties
import javax.xml.XMLConstants
Expand Down Expand Up @@ -60,7 +61,7 @@ object XercesValidatorFactory {
"invalid configuration: xerces property is empty or not defined"
)
}
val url = new URL(schemaFile)
val url = new URI(schemaFile).toURL
Comment thread
gdesrosiers1805 marked this conversation as resolved.
XercesValidator.fromURL(url)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ object XMLLoaderFactory {
val loader = new SchemaAwareFactoryAdapter()
loader
}

// val doc = loader.load(new URL("http://horstmann.com/index.html"))
// println(doc);
}

// From http://stackoverflow.com/questions/1627111/how-does-one-validate-the-schema-of-an-xml-file-using-scala
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package org.apache.daffodil.validation.schematron

import java.io.InputStream
import java.net.URI
import java.net.URL
import java.util.Properties

import org.apache.daffodil.api
Expand All @@ -44,13 +43,13 @@ import net.sf.saxon.TransformerFactoryImpl
object SchematronValidatorFactory {
def makeValidator(config: Properties): SchematronValidator = {
val schPathValue = config.getProperty(SchematronValidator.name)
val schUrl = new URL({
val schUrl = new URI({
if (!Misc.isNullOrBlank(schPathValue)) schPathValue
else
throw new api.validation.ValidatorInitializationException(
"invalid configuration: schematron property is empty or not defined"
)
})
}).toURL
val schStream =
try {
schUrl.openStream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.daffodil.infoset

import java.io.InputStream
import java.net.URL
import java.net.URI
import java.util.Properties

import org.apache.daffodil.api.validation.ValidationHandler
Expand All @@ -30,7 +30,7 @@ object TestStringAsXmlValidator {
}

class TestStringAsXmlValidator(schemaURL: String) extends Validator {
private lazy val xercesValidator = XercesValidator.fromURL(new URL(schemaURL))
private lazy val xercesValidator = XercesValidator.fromURL(new URI(schemaURL).toURL)

override def validateXML(document: InputStream, vh: ValidationHandler): Unit = {
xercesValidator.validateXML(document, vh)
Expand Down