You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Zabel, Court (Mission Systems)" <Co...@ngc.com> on 2005/03/08 01:31:13 UTC

Overriding xsi:schemaLocation throughout XML

I was just wondering if it's possible to prevent Xerces from evaluating xsi:schemaLocation declarations while performing a validating SAX parse of an XML document.

My application is accepting XML documents which must be validated against a schema which I provide as an InputSource via the "http://java.sun.com/xml/jaxp/properties/schemaSource" property.  I'd like to prevent it from loading more based on schemaLocations within the XML, that way I needn't worry if someone submitting XML is referencing local schemas.

When I parse the following document with the schema provided via the JAXP property:

<?xml version="1.0" encoding="UTF-8"?>
<my:root xmlns:my="my:namespace" my:att1="String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="my:namespace file://c:/foo.xsd">
	<my:ele1>String</my:ele1>
	<my:ele2>42</my:ele2>
</my:root>

my EntityResolver receives a call for Public ID="null" and System ID="file://c:/foo.xsd", where I wouldn't expect it to receive any calls at all.  Is there a particular parser or reader feature/property that I ought to be setting to prevent this?

Thanks,
 - Court

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org