<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Ajv is still failing on XMLSpy converted schema, and so is Java:</p>
<p>Here's a smattering of errors:</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> [java]
WARNING: Converting unescaped reference #/$defs/xs:NMTOKEN to
JSON Schema legal $ref form #/$defs/xs%3ANMTOKEN
</span><br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference #/$defs/xs:ID
to JSON Schema legal $ref form #/$defs/xs%3AID
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:IDREF to JSON Schema legal $ref form
#/$defs/xs%3AIDREF
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKENS to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKENS
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKEN to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKEN
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKEN to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKEN
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference #/$defs/xs:ID
to JSON Schema legal $ref form #/$defs/xs%3AID
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:IDREF to JSON Schema legal $ref form
#/$defs/xs%3AIDREF
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKENS to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKENS
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKEN to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKEN
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped
<br>
[java] WARNING: Converting unescaped reference
#/$defs/xs:NMTOKEN to JSON Schema legal $ref form
#/$defs/xs%3ANMTOKEN
<br>
[java] Oct 30, 2021 12:00:39 AM
net.jimblackler.jsonschemafriend.PathUtils fixUnescaped</span></p>
<p><span style="font-family:monospace">Should I start filing tickets
against Ajv and jsonschemafriend?</span></p>
<p><span style="font-family:monospace">Here is a small program for
your use for validating with Java:</span></p>
<p><br>
<span style="font-family:monospace"><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">$ cat
Main.java </span><br>
import net.jimblackler.jsonschemafriend.*;
<br>
import java.io.*;
<br>
<br>
public class Main {
<br>
public static void main(String[] args) {
<br>
try {
<br>
SchemaStore schemaStore = new SchemaStore(); //
Initialize a SchemaStore.
<br>
// Load the schema.
<br>
<br>
// Schema schema = schemaStore.loadSchema(new
File("x3d-4.0-JSONSchema.json"));
<br>
Schema schema = schemaStore.loadSchema(new
File("X3dXml4.0SchemaConvertedToJson2020-12Schema.json"));
<br>
<br>
for (int a = 0; a < args.length; a++) {
<br>
try {
<br>
new Validator().validate(schema, new
File(args[a]));
<br>
} catch (Exception ve) {
<br>
ve.printStackTrace();
<br>
}
<br>
}
<br>
} catch (SchemaException e) {
<br>
e.printStackTrace();
<br>
}
<br>
}
<br>
}<br>
</span></span></p>
<div class="moz-cite-prefix">On 10/29/21 23:44, John Carlson wrote:<br>
</div>
<blockquote type="cite"
cite="mid:f711e787-b4c4-4345-060d-d1eb9565e4c5@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>I was able to change Python validators, and the new one
validates with XMLSpy converted schemas! Woohoo!</p>
<p>Here's the main test script that I use, which I will check in:</p>
<p><br>
</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">import os </span><br>
from jschon import create_catalog, JSON, JSONSchema <br>
import json <br>
<br>
create_catalog('2020-12') <br>
<br>
# validate the X3D Resources examples with draft 2020-12 JSON
schema <br>
# validate one instance "instance" against X3D JSON Schema 4.0
<br>
<br>
class ValidateX3DJSON: <br>
# load a JSON file called jsonname into obj <br>
<br>
def load_json(self, jsonpre, jsonname): <br>
try: <br>
with open(jsonname, 'r') as jsonfile: <br>
obj = json.load(jsonfile) <br>
jsonfile.close() <br>
return obj <br>
except: <br>
print(f"{jsonpre}JsonInvalid", end=" ") <br>
return None <br>
<br>
# validate instance against two schemas <br>
def validate_with_schemas(self, entryPath, schemas, pres):
<br>
result = [ "jsonSkipped", "jwcSkipped", "dbSkipped"] <br>
<br>
try: <br>
result[0] = "jsonDidNotParse" <br>
instance = JSON(self.load_json("x3d", entryPath)) <br>
result[0] = "jsonParsed" <br>
for si in range(len(schemas)): <br>
result[si+1] = pres[si]+"Invalid" <br>
schemas[si].evaluate(instance) <br>
result[si+1] = pres[si]+"Valid" <br>
except: <br>
pass <br>
print(result[0], result[1], result[2], end=" ") <br>
<br>
def fileList(self, dirpath): <br>
for base, directories, filenames in
list(os.walk(dirpath)): <br>
for filename in filenames: <br>
if filename.endswith(".json"): <br>
fullpath = os.path.join(base, filename) <br>
yield fullpath <br>
<br>
<br>
<br>
if __name__ == "__main__": <br>
X3DJSONValidator = ValidateX3DJSON() <br>
pre = ["jwc", "db"] <br>
metaschema = JSONSchema(X3DJSONValidator.load_json("meta",
"../schema/2020-12-JSONSchema.json")) <br>
schemafiles = ('../schema/x3d-4.0-JSONSchema.json',
'../schema/X3dXml4.0SchemaConvertedToJson2020-12Schema.json')
<br>
schemas = [] <br>
for s in range(len(schemafiles)): <br>
schemas.append(JSONSchema(X3DJSONValidator.load_json(pre[s],
schemafiles[s]))) <br>
metaschema.evaluate(schemas[s]) <br>
for entryPath in
X3DJSONValidator.fileList("/c/x3d-code/www.web3d.org/x3d/content/examples"):<br>
X3DJSONValidator.validate_with_schemas(entryPath,
schemas, pre) <br>
print(entryPath)<br>
</span></p>
</blockquote>
</body>
</html>