@Override public void startElement(final String uri, final String localName, final String qName, final Attributes atts) throws SAXException { String tag = (uri.length() == 0) ? qName : localName; if (this.exception == null) { this.exception = new XMLTypeDetectionException(null, null); } this.exception.rootTag = tag; throw this.exception; } }
@Override public InputSource resolveEntity(final String publicId, final String systemId) { /** * As the xml schema of interest may be derived from other schema instances we * are only interested in the first entity resolved. */ if (! this.detectedFirstEntity){ this.exception = new XMLTypeDetectionException(publicId, systemId); this.detectedFirstEntity = true; } if (systemId.endsWith(".dtd")){ throw this.exception; } return null; }