stevedlawrence commented on code in PR #862:
URL: https://github.com/apache/daffodil/pull/862#discussion_r1007971417


##########
daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala:
##########
@@ -1155,3 +1156,23 @@ class DaffodilUnparseContentHandler private[japi] 
(sContentHandler: SDaffodilUnp
   override def skippedEntity(name: String): Unit =
     contentHandler.skippedEntity(name)
 }
+
+/**
+ * Returns the EntityResolver used by Daffodil to resolve import/include
+ * schemaLocations.
+ *
+ * DFDLCatalogResolver uses an org.apache.xml.resolver.Catalog/CatalogManager 
to
+ * attempt to resolve namespaces and systemId's. If we are unable to resolve a
+ * file with the Catalog, we attempt to resolve the file using the systemId 
path
+ * from the schemaLocation attribute. If this fails we throw a

Review Comment:
   > we attempt to resolve the file using the systemId path from the 
schemaLocation attribute.
   
   Does this require a little extra clarification? Don't we look at both the 
classpath and the filesystem, and if so, which do we do first? Is it worth 
mentioning relative paths in schemaLocations are relative to the file that 
includes (it I think that's right)?
   
   This might also work better as a numeric list, e.g.
   
   ```
   The returned resolver looks in the following places to resolve entities in 
this order:
   
   1. org.apache....CataogManager  ...
   2. Java classpath ...
   3. Filesystem ...
   ```



##########
daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala:
##########
@@ -1155,3 +1156,23 @@ class DaffodilUnparseContentHandler private[japi] 
(sContentHandler: SDaffodilUnp
   override def skippedEntity(name: String): Unit =
     contentHandler.skippedEntity(name)
 }
+
+/**
+ * Returns the EntityResolver used by Daffodil to resolve import/include
+ * schemaLocations.
+ *
+ * DFDLCatalogResolver uses an org.apache.xml.resolver.Catalog/CatalogManager 
to
+ * attempt to resolve namespaces and systemId's. If we are unable to resolve a
+ * file with the Catalog, we attempt to resolve the file using the systemId 
path
+ * from the schemaLocation attribute. If this fails we throw a
+ * SAXParseException.
+ *
+ * The DFDLCatalogResolver isn't thread safe, but it also is expensive and 
stateful,
+ * so we use ThreadLocal to only create one instance per thread.
+ */
+object DaffodilXMLEntityResolver {
+  def get = DFDLCatalogResolver.get

Review Comment:
   I don't think we should return this. No one needs access to a 
`DFDLCatalogResolver` and it's capabilities, they just need one of the other 
kind of revolvers. If we do find someone needs access to this, we can consider 
making it public. But until then let's keep that implementation private. It's 
much easier to make something public that's private than to make something 
private that's public.



##########
daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala:
##########
@@ -1155,3 +1156,23 @@ class DaffodilUnparseContentHandler private[japi] 
(sContentHandler: SDaffodilUnp
   override def skippedEntity(name: String): Unit =
     contentHandler.skippedEntity(name)
 }
+
+/**
+ * Returns the EntityResolver used by Daffodil to resolve import/include
+ * schemaLocations.
+ *
+ * DFDLCatalogResolver uses an org.apache.xml.resolver.Catalog/CatalogManager 
to

Review Comment:
   Don't mention `DFDLCatalogResolver`, that class isn't public so mentioning 
it in public API is just going to be confusing. The user will just get an 
`EntityResolver`, `XmlEntityResolver`, etc.--that's all they need to know about.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to