Fields Summary |
---|
protected final Vector | fRecognizedFeaturesRecognized features. |
protected final Vector | fRecognizedPropertiesRecognized properties. |
protected final Hashtable | fFeaturesFeatures. |
protected final Hashtable | fPropertiesProperties. |
protected org.apache.xerces.xni.parser.XMLEntityResolver | fEntityResolverThe registered entity resolver. |
protected org.apache.xerces.xni.parser.XMLErrorHandler | fErrorHandlerThe registered error handler. |
protected org.apache.xerces.xni.XMLDocumentHandler | fDocumentHandlerThe registered document handler. |
protected org.apache.xerces.xni.XMLDTDHandler | fDTDHandlerThe registered DTD handler. |
protected org.apache.xerces.xni.XMLDTDContentModelHandler | fDTDContentModelHandlerThe registered DTD content model handler. |
protected Locale | fLocaleLocale for error messages. |
protected final Vector | fComponentsList of configurable components. |
Methods Summary |
---|
protected void | addComponent(org.apache.xerces.xni.parser.XMLComponent component)Adds a component to list of configurable components. If the
same component is added multiple times, the component is
added only the first time.
This method helps manage the components in the configuration.
Therefore, all subclasses should call this method to add the
components specific to the configuration.
if (!fComponents.contains(component)) {
fComponents.addElement(component);
addRecognizedFeatures(component.getRecognizedFeatures());
addRecognizedProperties(component.getRecognizedProperties());
}
|
public void | addRecognizedFeatures(java.lang.String[] featureIds)Allows a parser to add parser specific features to be recognized
and managed by the parser configuration.
//
// XMLParserConfiguration methods
//
int length = featureIds != null ? featureIds.length : 0;
for (int i = 0; i < length; i++) {
String featureId = featureIds[i];
if (!fRecognizedFeatures.contains(featureId)) {
fRecognizedFeatures.addElement(featureId);
}
}
|
public void | addRecognizedProperties(java.lang.String[] propertyIds)Allows a parser to add parser specific properties to be recognized
and managed by the parser configuration.
int length = propertyIds != null ? propertyIds.length : 0;
for (int i = 0; i < length; i++) {
String propertyId = propertyIds[i];
if (!fRecognizedProperties.contains(propertyId)) {
fRecognizedProperties.addElement(propertyId);
}
}
|
public org.apache.xerces.xni.XMLDTDContentModelHandler | getDTDContentModelHandler()Returns the registered DTD content model handler.
return fDTDContentModelHandler;
|
public org.apache.xerces.xni.XMLDTDHandler | getDTDHandler()Returns the registered DTD handler.
return fDTDHandler;
|
public org.apache.xerces.xni.XMLDocumentHandler | getDocumentHandler()Returns the registered document handler.
return fDocumentHandler;
|
public org.apache.xerces.xni.parser.XMLEntityResolver | getEntityResolver()Returns the registered entity resolver.
return fEntityResolver;
|
public org.apache.xerces.xni.parser.XMLErrorHandler | getErrorHandler()Returns the registered error handler.
return fErrorHandler;
|
public boolean | getFeature(java.lang.String featureId)Returns the state of a feature.
if (!fRecognizedFeatures.contains(featureId)) {
short type = XMLConfigurationException.NOT_RECOGNIZED;
throw new XMLConfigurationException(type, featureId);
}
Boolean state = (Boolean)fFeatures.get(featureId);
return state != null ? state.booleanValue() : false;
|
public java.util.Locale | getLocale()Returns the locale.
return fLocale;
|
public java.lang.Object | getProperty(java.lang.String propertyId)Returns the value of a property.
if (!fRecognizedProperties.contains(propertyId)) {
short type = XMLConfigurationException.NOT_RECOGNIZED;
throw new XMLConfigurationException(type, propertyId);
}
Object value = fProperties.get(propertyId);
return value;
|
protected void | openInputSourceStream(org.apache.xerces.xni.parser.XMLInputSource source)This method tries to open the necessary stream for the given
XMLInputSource. If the input source already has a character
stream (java.io.Reader) or a byte stream (java.io.InputStream)
set, this method returns immediately. However, if no character
or byte stream is already open, this method attempts to open
an input stream using the source's system identifier.
if (source.getCharacterStream() != null) {
return;
}
InputStream stream = source.getByteStream();
if (stream == null) {
String systemId = source.getSystemId();
try {
URL url = new URL(systemId);
stream = url.openStream();
}
catch (MalformedURLException e) {
stream = new FileInputStream(systemId);
}
source.setByteStream(stream);
}
|
public abstract void | parse(org.apache.xerces.xni.parser.XMLInputSource inputSource)Parse an XML document.
The parser can use this method to instruct this configuration
to begin parsing an XML document from any valid input source
(a character stream, a byte stream, or a URI).
Parsers may not invoke this method while a parse is in progress.
Once a parse is complete, the parser may then parse another XML
document.
This method is synchronous: it will not return until parsing
has ended. If a client application wants to terminate
parsing early, it should throw an exception.
Note: This method needs to be implemented
by the subclass.
|
protected void | resetComponents()Resets all of the registered components. Before the subclassed
configuration begins parsing, it should call this method to
reset the components.
int length = fComponents.size();
for (int i = 0; i < length; i++) {
XMLComponent component = (XMLComponent)fComponents.elementAt(i);
component.reset(this);
}
|
public void | setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler handler)Sets the DTD content model handler.
fDTDContentModelHandler = handler;
|
public void | setDTDHandler(org.apache.xerces.xni.XMLDTDHandler handler)Sets the DTD handler.
fDTDHandler = handler;
|
public void | setDocumentHandler(org.apache.xerces.xni.XMLDocumentHandler handler)Sets the document handler to receive information about the document.
fDocumentHandler = handler;
|
public void | setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver resolver)Sets the entity resolver.
fEntityResolver = resolver;
|
public void | setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler handler)Sets the error handler.
fErrorHandler = handler;
|
public void | setFeature(java.lang.String featureId, boolean state)Sets the state of a feature. This method is called by the parser
and gets propagated to components in this parser configuration.
if (!fRecognizedFeatures.contains(featureId)) {
short type = XMLConfigurationException.NOT_RECOGNIZED;
throw new XMLConfigurationException(type, featureId);
}
fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
int length = fComponents.size();
for (int i = 0; i < length; i++) {
XMLComponent component = (XMLComponent)fComponents.elementAt(i);
component.setFeature(featureId, state);
}
|
public void | setLocale(java.util.Locale locale)Set the locale to use for messages.
fLocale = locale;
|
public void | setProperty(java.lang.String propertyId, java.lang.Object value)Sets the value of a property. This method is called by the parser
and gets propagated to components in this parser configuration.
if (!fRecognizedProperties.contains(propertyId)) {
short type = XMLConfigurationException.NOT_RECOGNIZED;
throw new XMLConfigurationException(type, propertyId);
}
if (value != null) {
fProperties.put(propertyId, value);
}
else {
fProperties.remove(propertyId);
}
int length = fComponents.size();
for (int i = 0; i < length; i++) {
XMLComponent component = (XMLComponent)fComponents.elementAt(i);
component.setProperty(propertyId, value);
}
|