yas
yas

Reputation: 3620

How to configure Xerces2-J to ingore xsi:schemaLocation hints?

I am using Xerces2-J and have built a grammar pool as described in the Grammars FAQ

When parsing the document instance, I would like the parser to ignore any xsi:schemaLocation or xsi:noNamespaceSchemaLocation hints.

The FAQ says

registering a do-nothing EntityResolver will allow the application to deny validators from using any but the "approved" grammar set.

How is a "do-nothing" entity resolver implemented? The entity resolver needs to implement the XMLEntityResolver interface, which has one method:

public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
    throws XNIException, IOException;

Returning null will default to the system behavior of trying to resolve the resourceIdentifier. What return value can be used to simply ignore the resolveEntity request?

Upvotes: 1

Views: 37

Answers (0)

Related Questions