|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.XMLFilterImpl
xml.parser.SchemaAutoLoader
public class SchemaAutoLoader
XMLFilter inserting a Validator based upon rules defined in a SchemaMapping. The schema is inserted between the parser and this SchemaAutoLoader in the chain. If a schema is found, a RewindException is thrown, because it saves a tedious replay mecanism (see the commented out Replay class). If this is not acceptable, don't forget to call startElement with the document element, and to filter out the startDocument(), startElement() events. This component is only interested in introducing Validators, not providing completion. If the inserted VerifierFilter doesn't implement EntityResolver2, entity resolution might fail. finding a test case is not easy, since resolution is mainly used to load a schema...
| Constructor Summary | |
|---|---|
SchemaAutoLoader(org.xml.sax.XMLReader parent,
SchemaMapping mapping,
org.gjt.sp.jedit.Buffer requestingBuffer)
|
|
| Method Summary | |
|---|---|
void |
forceSchema(java.lang.String baseURI,
java.lang.String schemaURI)
force the schema to use for validation and CompletionInfo. |
java.util.Map<java.lang.String,CompletionInfo> |
getCompletionInfo()
only Relax NG schemas are supported for the moment |
org.xml.sax.InputSource |
getExternalSubset(java.lang.String name,
java.lang.String baseURI)
manually implement EntityResolver2 because XMLFilterImpl only implements EntityResolver, and we need EntityResolver2 for Resolver to work properly |
java.lang.String |
getSchemaURL()
this doesn't return the schema bound using xsi:schemalocation nor the DTD file : only a schema discovered via the SchemaMapping instance. |
void |
parse(org.xml.sax.InputSource input)
capture system and public ID to find a matching schema mapping, |
void |
parse(java.lang.String systemId)
capture sytem ID to find a matching schema mapping |
org.xml.sax.InputSource |
resolveEntity(java.lang.String name,
java.lang.String publicId,
java.lang.String baseURI,
java.lang.String systemId)
manually implement EntityResolver2 because XMLFilterImpl only implements EntityResolver, and we need EntityResolver2 for Resolver to work properly |
void |
setDocumentLocator(org.xml.sax.Locator l)
capture the locator, in case we need to pass it to a schema |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
if this is the root element, try to find a matching schema, instantiate it and insert it in the parsing chain. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String ns)
|
| Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
|---|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xml.sax.EntityResolver |
|---|
resolveEntity |
| Constructor Detail |
|---|
public SchemaAutoLoader(org.xml.sax.XMLReader parent,
SchemaMapping mapping,
org.gjt.sp.jedit.Buffer requestingBuffer)
parent - parent in the XML parsing chainmapping - schema-mapping rules or null if you plan to force the schema| Method Detail |
|---|
public void forceSchema(java.lang.String baseURI,
java.lang.String schemaURI)
throws org.xml.sax.SAXException,
java.io.IOException,
java.net.URISyntaxException
baseURI - baseURI to resolve the schemaURI against (may be null if schemaURI is absolute)schemaURI - URI of the schema to install
org.xml.sax.SAXException
java.io.IOException
java.net.URISyntaxExceptionpublic java.lang.String getSchemaURL()
public java.util.Map<java.lang.String,CompletionInfo> getCompletionInfo()
public void parse(org.xml.sax.InputSource input)
throws org.xml.sax.SAXException,
java.io.IOException
parse in interface org.xml.sax.XMLReaderparse in class org.xml.sax.helpers.XMLFilterImplinput - input to parse
org.xml.sax.SAXException
java.io.IOException
public void parse(java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
parse in interface org.xml.sax.XMLReaderparse in class org.xml.sax.helpers.XMLFilterImplsystemId - systemId of the input to parse
org.xml.sax.SAXException
java.io.IOException
public void startPrefixMapping(java.lang.String prefix,
java.lang.String ns)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXException
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXException
public org.xml.sax.InputSource resolveEntity(java.lang.String name,
java.lang.String publicId,
java.lang.String baseURI,
java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
resolveEntity in interface org.xml.sax.ext.EntityResolver2java.lang.UnsupportedOperationException - if getEntityResolver() doesn't implement EntityResolver2
org.xml.sax.SAXException
java.io.IOException
public org.xml.sax.InputSource getExternalSubset(java.lang.String name,
java.lang.String baseURI)
throws org.xml.sax.SAXException,
java.io.IOException
getExternalSubset in interface org.xml.sax.ext.EntityResolver2java.lang.UnsupportedOperationException - if getEntityResolver() doesn't implement EntityResolver2
org.xml.sax.SAXException
java.io.IOExceptionpublic void setDocumentLocator(org.xml.sax.Locator l)
setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.XMLFilterImplinstallJaxpGrammar(java.net.URI,String,boolean)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||