Skip to content

Commit

Permalink
improved context handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rainer-prosi committed Dec 23, 2022
1 parent 8700f16 commit 8bbc236
Show file tree
Hide file tree
Showing 3 changed files with 14,432 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/main/java/org/cip4/lib/jdf/jsonutil/JSONReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,28 @@ String getKey(final String key, Object object, KElement root)
String prefix = KElement.xmlnsPrefix(key);
if (prefix != null)
{
String namespaceURIFromPrefix = root.getNamespaceURIFromPrefix(prefix);
if (namespaceURIFromPrefix == null)
if (root != null)
{
if (object instanceof JSONObject)
String namespaceURIFromPrefix = root.getNamespaceURIFromPrefix(prefix);
if (namespaceURIFromPrefix == null)
{
processContext(((JSONObject) object).get("@context"), root);
if (object instanceof JSONObject)
{
Object context = ((JSONObject) object).get("@context");
if (context != null)
{
processContext(context, root);
return key;
}
}
}
else
{
log.warn("Missing context for prefix: " + key);
return KElement.xmlnsLocalName(key);
return key;
}
}
log.warn("Missing context for prefix: " + key);
return KElement.xmlnsLocalName(key);
}
return key;
}
Expand Down
Loading

0 comments on commit 8bbc236

Please sign in to comment.