public final class Example5 extends ExampleBase
This example demonstrates another capability of JsonSchemaFactory
:
the ability to set a URI namespace. This requires to customize the factory,
and therefore go through JsonSchemaFactory.Builder
, and more precisely JsonSchemaFactory.Builder.setNamespace(String)
. After this, JsonSchemaFactory.fromURI(
String)
and assimilates will resolve all URIs against this namespace (which
is empty by default).
The schemas are split in two:
The first refers to the second one via the relative URI mntent.json
. This works precisely because a URI namespace has been set: all
URIs are resolved against this namespace.
Files validated, and the validation outputs, are the same as for Example2
.
Constructor and Description |
---|
Example5() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String... args) |
loadResource, printReport
public static void main(String... args) throws IOException, JsonSchemaException
IOException
JsonSchemaException
Copyright © 2013. All Rights Reserved.