|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.validation.impl.ValidationResolver org.apache.cocoon.components.validation.jing.JingResolver
public class JingResolver
A simple resolver used when parsing RELAX NG schemas through the use of JING.
This is not thread safe and not recyclable. Once used, it must be garbage collected.
Constructor Summary | |
---|---|
JingResolver(SourceResolver sourceResolver,
EntityResolver entityResolver)
Create a new JingResolver instance. |
Method Summary | |
---|---|
XMLReader |
createXMLReader()
Create an XMLReader instance that can be used by
JING for
parsing schemas. |
InputSource |
popInputSource()
Pop the last InputSource from the stack used for relative URIs
resolution. |
void |
pushInputSource(InputSource inputSource)
Push a new InputSource in the stack used for relative URIs
resolution. |
InputSource |
resolveEntity(String publicId,
String systemId)
Resolve an InputSource from a public ID and/or a system ID. |
Methods inherited from class org.apache.cocoon.components.validation.impl.ValidationResolver |
---|
close, finalize, resolveEntity, resolveEntity, resolveSource, resolveSource, resolveSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JingResolver(SourceResolver sourceResolver, EntityResolver entityResolver)
Create a new JingResolver
instance.
Method Detail |
---|
public void pushInputSource(InputSource inputSource)
Push a new InputSource
in the stack used for relative URIs
resolution.
public InputSource popInputSource()
Pop the last InputSource
from the stack used for relative URIs
resolution.
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
Resolve an InputSource
from a public ID and/or a system ID.
This method can be called only while a schema is being parsed and will
resolve URIs against a dynamic Stack
of InputSource
s.
Since JING
doesn't offer a complete URI resolution contract, a Stack
is kept
for all the sources parsed while reading a schema. Keeping in mind that the
last InputSource
pushed in the Stack
can be considered to be
the "base URI" for the current resolution, full relative resolution of system
IDs can be achieved this way.
Note that this method of resolving URIs by keeping a Stack
of
processed URIs is a sort of a hack, but it mimics the internal state
of JING itself:
if URI resolution fails, the Stack
analysis is the first part to
look at.
Resolution will use the EntityResolver
specified at construction
to resolve public IDs, and then the SourceResolver
again specified at
construction to resolve the system IDs and to access the underlying byte
streams of the entities to be parsed.
resolveEntity
in interface EntityResolver
resolveEntity
in class ValidationResolver
publicId
- the public ID of the entity to resolve.systemId
- the system ID of the entity to resolve.
InputSource
instance.
IOException
- if an I/O error occurred resolving the entity.
SAXException
- if an XML error occurred resolving the entity.public XMLReader createXMLReader() throws SAXException
Create an XMLReader
instance that can be used by
JING for
parsing schemas.
The returned XMLReader
will keep track of populating/clearing the
Stack
of InputSource
s kept for URI resolution as explained
in the description of the resolveEntity(String, String)
method.
createXMLReader
in interface com.thaiopensource.xml.sax.XMLReaderCreator
XMLReader
instance.
SAXException
- if an error occurrent creating the XMLReader
.JingReader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |