2
* The Apache Software License, Version 1.1
5
* Copyright (c) 2001-2004 The Apache Software Foundation.
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
12
* 1. Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in
17
* the documentation and/or other materials provided with the
20
* 3. The end-user documentation included with the redistribution,
21
* if any, must include the following acknowledgment:
22
* "This product includes software developed by the
23
* Apache Software Foundation (http://www.apache.org/)."
24
* Alternately, this acknowledgment may appear in the software itself,
25
* if and wherever such third-party acknowledgments normally appear.
27
* 4. The names "Xerces" and "Apache Software Foundation" must
28
* not be used to endorse or promote products derived from this
29
* software without prior written permission. For written
30
* permission, please contact apache@apache.org.
32
* 5. Products derived from this software may not be called "Apache",
33
* nor may "Apache" appear in their name, without prior written
34
* permission of the Apache Software Foundation.
36
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48
* ====================================================================
50
* This software consists of voluntary contributions made by many
51
* individuals on behalf of the Apache Software Foundation and was
52
* originally based on software copyright (c) 1999, International
53
* Business Machines, Inc., http://www.apache.org. For more
54
* information on the Apache Software Foundation, please see
55
* <http://www.apache.org/>.
58
package org.apache.xerces.parsers;
60
import java.io.IOException;
61
import java.util.Locale;
63
import org.apache.xerces.impl.Constants;
64
import org.apache.xerces.impl.XMLDTDScannerImpl;
65
import org.apache.xerces.impl.XMLDocumentScannerImpl;
66
import org.apache.xerces.impl.XMLEntityManager;
67
import org.apache.xerces.impl.XMLErrorReporter;
68
import org.apache.xerces.impl.XMLNSDocumentScannerImpl;
69
import org.apache.xerces.impl.dv.DTDDVFactory;
70
import org.apache.xerces.impl.msg.XMLMessageFormatter;
71
import org.apache.xerces.impl.validation.ValidationManager;
72
import org.apache.xerces.util.SymbolTable;
73
import org.apache.xerces.xni.XMLLocator;
74
import org.apache.xerces.xni.XNIException;
75
import org.apache.xerces.xni.grammars.XMLGrammarPool;
76
import org.apache.xerces.xni.parser.XMLComponent;
77
import org.apache.xerces.xni.parser.XMLComponentManager;
78
import org.apache.xerces.xni.parser.XMLConfigurationException;
79
import org.apache.xerces.xni.parser.XMLDTDScanner;
80
import org.apache.xerces.xni.parser.XMLDocumentScanner;
81
import org.apache.xerces.xni.parser.XMLInputSource;
82
import org.apache.xerces.xni.parser.XMLPullParserConfiguration;
85
* This is the non validating parser configuration. It extends the basic
86
* configuration with the set of following parser components:
87
* Document scanner, DTD scanner, namespace binder, document handler.
89
* Xerces parser that uses this configuration is <strong>not</strong> <a href="http://www.w3.org/TR/REC-xml#sec-conformance">conformant</a>
90
* non-validating XML processor, since conformant non-validating processor is required
91
* to process "all the declarations they read in the internal DTD subset ... must use the information in those declarations to normalize attribute values,
92
* include the replacement text of internal entities, and supply default attribute values".
94
* @author Elena Litani, IBM
95
* @version $Id: NonValidatingConfiguration.java,v 1.12 2004/01/26 17:28:10 mrglavas Exp $
97
public class NonValidatingConfiguration
98
extends BasicParserConfiguration
99
implements XMLPullParserConfiguration {
105
// feature identifiers
107
/** Feature identifier: warn on duplicate attribute definition. */
108
protected static final String WARN_ON_DUPLICATE_ATTDEF =
109
Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE;
111
/** Feature identifier: warn on duplicate entity definition. */
112
protected static final String WARN_ON_DUPLICATE_ENTITYDEF =
113
Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;
115
/** Feature identifier: warn on undeclared element definition. */
116
protected static final String WARN_ON_UNDECLARED_ELEMDEF =
117
Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE;
119
/** Feature identifier: allow Java encodings. */
120
protected static final String ALLOW_JAVA_ENCODINGS =
121
Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE;
123
/** Feature identifier: continue after fatal error. */
124
protected static final String CONTINUE_AFTER_FATAL_ERROR =
125
Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
127
/** Feature identifier: load external DTD. */
128
protected static final String LOAD_EXTERNAL_DTD =
129
Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
131
/** Feature identifier: notify built-in refereces. */
132
protected static final String NOTIFY_BUILTIN_REFS =
133
Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;
135
/** Feature identifier: notify character refereces. */
136
protected static final String NOTIFY_CHAR_REFS =
137
Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_CHAR_REFS_FEATURE;
140
/** Feature identifier: expose schema normalized value */
141
protected static final String NORMALIZE_DATA =
142
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_NORMALIZED_VALUE;
145
/** Feature identifier: send element default value via characters() */
146
protected static final String SCHEMA_ELEMENT_DEFAULT =
147
Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_ELEMENT_DEFAULT;
149
// property identifiers
151
/** Property identifier: error reporter. */
152
protected static final String ERROR_REPORTER =
153
Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
155
/** Property identifier: entity manager. */
156
protected static final String ENTITY_MANAGER =
157
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
159
/** Property identifier document scanner: */
160
protected static final String DOCUMENT_SCANNER =
161
Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
163
/** Property identifier: DTD scanner. */
164
protected static final String DTD_SCANNER =
165
Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
167
/** Property identifier: grammar pool. */
168
protected static final String XMLGRAMMAR_POOL =
169
Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
171
/** Property identifier: DTD validator. */
172
protected static final String DTD_VALIDATOR =
173
Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_VALIDATOR_PROPERTY;
175
/** Property identifier: namespace binder. */
176
protected static final String NAMESPACE_BINDER =
177
Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_BINDER_PROPERTY;
179
/** Property identifier: datatype validator factory. */
180
protected static final String DATATYPE_VALIDATOR_FACTORY =
181
Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
183
protected static final String VALIDATION_MANAGER =
184
Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
186
/** Property identifier: XML Schema validator. */
187
protected static final String SCHEMA_VALIDATOR =
188
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
193
/** Set to true and recompile to print exception stack trace. */
194
private static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
200
// components (non-configurable)
203
protected XMLGrammarPool fGrammarPool;
205
/** Datatype validator factory. */
206
protected DTDDVFactory fDatatypeValidatorFactory;
208
// components (configurable)
210
/** Error reporter. */
211
protected XMLErrorReporter fErrorReporter;
213
/** Entity manager. */
214
protected XMLEntityManager fEntityManager;
216
/** Document scanner. */
217
protected XMLDocumentScanner fScanner;
220
protected XMLInputSource fInputSource;
223
protected XMLDTDScanner fDTDScanner;
226
protected ValidationManager fValidationManager;
230
/** Document scanner that does namespace binding. */
231
private XMLNSDocumentScannerImpl fNamespaceScanner;
233
/** Default Xerces implementation of scanner*/
234
private XMLDocumentScannerImpl fNonNSScanner;
237
/** fConfigUpdated is set to true if there has been any change to the configuration settings,
238
* i.e a feature or a property was changed.
240
protected boolean fConfigUpdated = false;
246
protected XMLLocator fLocator;
249
* True if a parse is in progress. This state is needed because
250
* some features/properties cannot be set while parsing (e.g.
251
* validation and namespaces).
253
protected boolean fParseInProgress = false;
259
/** Default constructor. */
260
public NonValidatingConfiguration() {
261
this(null, null, null);
265
* Constructs a parser configuration using the specified symbol table.
267
* @param symbolTable The symbol table to use.
269
public NonValidatingConfiguration(SymbolTable symbolTable) {
270
this(symbolTable, null, null);
271
} // <init>(SymbolTable)
274
* Constructs a parser configuration using the specified symbol table and
277
* <strong>REVISIT:</strong>
278
* Grammar pool will be updated when the new validation engine is
281
* @param symbolTable The symbol table to use.
282
* @param grammarPool The grammar pool to use.
284
public NonValidatingConfiguration(SymbolTable symbolTable,
285
XMLGrammarPool grammarPool) {
286
this(symbolTable, grammarPool, null);
287
} // <init>(SymbolTable,XMLGrammarPool)
290
* Constructs a parser configuration using the specified symbol table,
291
* grammar pool, and parent settings.
293
* <strong>REVISIT:</strong>
294
* Grammar pool will be updated when the new validation engine is
297
* @param symbolTable The symbol table to use.
298
* @param grammarPool The grammar pool to use.
299
* @param parentSettings The parent settings.
301
public NonValidatingConfiguration(SymbolTable symbolTable,
302
XMLGrammarPool grammarPool,
303
XMLComponentManager parentSettings) {
304
super(symbolTable, parentSettings);
306
// add default recognized features
307
final String[] recognizedFeatures = {
310
//WARN_ON_DUPLICATE_ATTDEF, // from XMLDTDScannerImpl
311
//WARN_ON_UNDECLARED_ELEMDEF, // from XMLDTDScannerImpl
312
//ALLOW_JAVA_ENCODINGS, // from XMLEntityManager
313
CONTINUE_AFTER_FATAL_ERROR,
314
//LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
315
//NOTIFY_BUILTIN_REFS, // from XMLDocumentFragmentScannerImpl
316
//NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl
317
//WARN_ON_DUPLICATE_ENTITYDEF // from XMLEntityManager
319
addRecognizedFeatures(recognizedFeatures);
321
// set state for default features
322
//setFeature(WARN_ON_DUPLICATE_ATTDEF, false); // from XMLDTDScannerImpl
323
//setFeature(WARN_ON_UNDECLARED_ELEMDEF, false); // from XMLDTDScannerImpl
324
//setFeature(ALLOW_JAVA_ENCODINGS, false); // from XMLEntityManager
325
fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
326
fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
327
fFeatures.put(NAMESPACES, Boolean.TRUE);
328
//setFeature(LOAD_EXTERNAL_DTD, true); // from XMLDTDScannerImpl
329
//setFeature(NOTIFY_BUILTIN_REFS, false); // from XMLDocumentFragmentScannerImpl
330
//setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl
331
//setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager
333
// add default recognized properties
334
final String[] recognizedProperties = {
342
DATATYPE_VALIDATOR_FACTORY,
345
addRecognizedProperties(recognizedProperties);
347
fGrammarPool = grammarPool;
348
if(fGrammarPool != null){
349
fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
352
fEntityManager = createEntityManager();
353
fProperties.put(ENTITY_MANAGER, fEntityManager);
354
addComponent(fEntityManager);
356
fErrorReporter = createErrorReporter();
357
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
358
fProperties.put(ERROR_REPORTER, fErrorReporter);
359
addComponent(fErrorReporter);
361
// this configuration delays creation of the scanner
362
// till it is known if namespace processing should be performed
364
fDTDScanner = createDTDScanner();
365
if (fDTDScanner != null) {
366
fProperties.put(DTD_SCANNER, fDTDScanner);
367
if (fDTDScanner instanceof XMLComponent) {
368
addComponent((XMLComponent)fDTDScanner);
372
fDatatypeValidatorFactory = createDatatypeValidatorFactory();
373
if (fDatatypeValidatorFactory != null) {
374
fProperties.put(DATATYPE_VALIDATOR_FACTORY,
375
fDatatypeValidatorFactory);
377
fValidationManager = createValidationManager();
379
if (fValidationManager != null) {
380
fProperties.put(VALIDATION_MANAGER, fValidationManager);
382
// add message formatters
383
if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
384
XMLMessageFormatter xmft = new XMLMessageFormatter();
385
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
386
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
389
fConfigUpdated = false;
393
setLocale(Locale.getDefault());
395
catch (XNIException e) {
397
// REVISIT: What is the right thing to do? -Ac
400
} // <init>(SymbolTable,XMLGrammarPool)
405
public void setFeature(String featureId, boolean state)
406
throws XMLConfigurationException {
407
fConfigUpdated = true;
408
super.setFeature(featureId, state);
411
public void setProperty(String propertyId, Object value)
412
throws XMLConfigurationException {
413
fConfigUpdated = true;
414
super.setProperty(propertyId, value);
417
* Set the locale to use for messages.
419
* @param locale The locale object to use for localization of messages.
421
* @exception XNIException Thrown if the parser does not support the
424
public void setLocale(Locale locale) throws XNIException {
425
super.setLocale(locale);
426
fErrorReporter.setLocale(locale);
427
} // setLocale(Locale)
429
public boolean getFeature(String featureId)
430
throws XMLConfigurationException {
431
// make this feature special
432
if (featureId.equals(PARSER_SETTINGS)){
433
return fConfigUpdated;
435
return super.getFeature(featureId);
437
} // getFeature(String):boolean
439
// XMLPullParserConfiguration methods
445
* Sets the input source for the document to parse.
447
* @param inputSource The document's input source.
449
* @exception XMLConfigurationException Thrown if there is a
450
* configuration error when initializing the
452
* @exception IOException Thrown on I/O error.
454
* @see #parse(boolean)
456
public void setInputSource(XMLInputSource inputSource)
457
throws XMLConfigurationException, IOException {
459
// REVISIT: this method used to reset all the components and
460
// construct the pipeline. Now reset() is called
461
// in parse (boolean) just before we parse the document
462
// Should this method still throw exceptions..?
464
fInputSource = inputSource;
466
} // setInputSource(XMLInputSource)
469
* Parses the document in a pull parsing fashion.
471
* @param complete True if the pull parser should parse the
472
* remaining document completely.
474
* @return True if there is more document to parse.
476
* @exception XNIException Any XNI exception, possibly wrapping
478
* @exception IOException An IO exception from the parser, possibly
479
* from a byte stream or character stream
480
* supplied by the parser.
482
* @see #setInputSource
484
public boolean parse(boolean complete) throws XNIException, IOException {
486
// reset and configure pipeline and set InputSource.
487
if (fInputSource !=null) {
489
// resets and sets the pipeline.
491
fScanner.setInputSource(fInputSource);
494
catch (XNIException ex) {
495
if (PRINT_EXCEPTION_STACK_TRACE)
496
ex.printStackTrace();
499
catch (IOException ex) {
500
if (PRINT_EXCEPTION_STACK_TRACE)
501
ex.printStackTrace();
504
catch (RuntimeException ex) {
505
if (PRINT_EXCEPTION_STACK_TRACE)
506
ex.printStackTrace();
509
catch (Exception ex) {
510
if (PRINT_EXCEPTION_STACK_TRACE)
511
ex.printStackTrace();
512
throw new XNIException(ex);
517
return fScanner.scanDocument(complete);
519
catch (XNIException ex) {
520
if (PRINT_EXCEPTION_STACK_TRACE)
521
ex.printStackTrace();
524
catch (IOException ex) {
525
if (PRINT_EXCEPTION_STACK_TRACE)
526
ex.printStackTrace();
529
catch (RuntimeException ex) {
530
if (PRINT_EXCEPTION_STACK_TRACE)
531
ex.printStackTrace();
534
catch (Exception ex) {
535
if (PRINT_EXCEPTION_STACK_TRACE)
536
ex.printStackTrace();
537
throw new XNIException(ex);
540
} // parse(boolean):boolean
543
* If the application decides to terminate parsing before the xml document
544
* is fully parsed, the application should call this method to free any
545
* resource allocated during parsing. For example, close all opened streams.
547
public void cleanup() {
548
fEntityManager.closeReaders();
552
// XMLParserConfiguration methods
556
* Parses the specified input source.
558
* @param source The input source.
560
* @exception XNIException Throws exception on XNI error.
561
* @exception java.io.IOException Throws exception on i/o error.
563
public void parse(XMLInputSource source) throws XNIException, IOException {
565
if (fParseInProgress) {
566
// REVISIT - need to add new error message
567
throw new XNIException("FWK005 parse may not be called while parsing.");
569
fParseInProgress = true;
572
setInputSource(source);
575
catch (XNIException ex) {
576
if (PRINT_EXCEPTION_STACK_TRACE)
577
ex.printStackTrace();
580
catch (IOException ex) {
581
if (PRINT_EXCEPTION_STACK_TRACE)
582
ex.printStackTrace();
585
catch (RuntimeException ex) {
586
if (PRINT_EXCEPTION_STACK_TRACE)
587
ex.printStackTrace();
590
catch (Exception ex) {
591
if (PRINT_EXCEPTION_STACK_TRACE)
592
ex.printStackTrace();
593
throw new XNIException(ex);
596
fParseInProgress = false;
597
// close all streams opened by xerces
601
} // parse(InputSource)
608
* Reset all components before parsing.
610
* @throws XNIException Thrown if an error occurs during initialization.
612
protected void reset() throws XNIException {
614
if (fValidationManager != null)
615
fValidationManager.reset();
616
// configure the pipeline and initialize the components
622
/** Configures the pipeline. */
623
protected void configurePipeline() {
624
// create appropriate scanner
625
// and register it as one of the components.
626
if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
627
if (fNamespaceScanner == null) {
628
fNamespaceScanner = new XMLNSDocumentScannerImpl();
629
addComponent((XMLComponent)fNamespaceScanner);
631
fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
632
fNamespaceScanner.setDTDValidator(null);
633
fScanner = fNamespaceScanner;
636
if (fNonNSScanner == null) {
637
fNonNSScanner = new XMLDocumentScannerImpl();
638
addComponent((XMLComponent)fNonNSScanner);
640
fProperties.put(DOCUMENT_SCANNER, fNonNSScanner);
641
fScanner = fNonNSScanner;
644
fScanner.setDocumentHandler(fDocumentHandler);
645
fLastComponent = fScanner;
646
// setup dtd pipeline
647
if (fDTDScanner != null) {
648
fDTDScanner.setDTDHandler(fDTDHandler);
649
fDTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
653
} // configurePipeline()
655
// features and properties
658
* Check a feature. If feature is know and supported, this method simply
659
* returns. Otherwise, the appropriate exception is thrown.
661
* @param featureId The unique identifier (URI) of the feature.
663
* @throws XMLConfigurationException Thrown for configuration error.
664
* In general, components should
665
* only throw this exception if
666
* it is <strong>really</strong>
669
protected void checkFeature(String featureId)
670
throws XMLConfigurationException {
676
if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
677
final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
680
// http://apache.org/xml/features/validation/dynamic
681
// Allows the parser to validate a document only when it
682
// contains a grammar. Validation is turned on/off based
683
// on each document instance, automatically.
685
if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() &&
686
featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) {
690
// http://apache.org/xml/features/validation/default-attribute-values
692
if (suffixLength == Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length() &&
693
featureId.endsWith(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
695
short type = XMLConfigurationException.NOT_SUPPORTED;
696
throw new XMLConfigurationException(type, featureId);
699
// http://apache.org/xml/features/validation/default-attribute-values
701
if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() &&
702
featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
704
short type = XMLConfigurationException.NOT_SUPPORTED;
705
throw new XMLConfigurationException(type, featureId);
708
// http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
710
if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() &&
711
featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
715
// http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
717
if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() &&
718
featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
723
// http://apache.org/xml/features/validation/default-attribute-values
725
if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
726
featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
727
short type = XMLConfigurationException.NOT_SUPPORTED;
728
throw new XMLConfigurationException(type, featureId);
736
super.checkFeature(featureId);
738
} // checkFeature(String)
741
* Check a property. If the property is know and supported, this method
742
* simply returns. Otherwise, the appropriate exception is thrown.
744
* @param propertyId The unique identifier (URI) of the property
747
* @throws XMLConfigurationException Thrown for configuration error.
748
* In general, components should
749
* only throw this exception if
750
* it is <strong>really</strong>
753
protected void checkProperty(String propertyId)
754
throws XMLConfigurationException {
760
if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
761
final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
763
if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() &&
764
propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
769
if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
770
final int suffixLength = propertyId.length() - Constants.JAXP_PROPERTY_PREFIX.length();
772
if (suffixLength == Constants.SCHEMA_SOURCE.length() &&
773
propertyId.endsWith(Constants.SCHEMA_SOURCE)) {
782
super.checkProperty(propertyId);
784
} // checkProperty(String)
788
/** Creates an entity manager. */
789
protected XMLEntityManager createEntityManager() {
790
return new XMLEntityManager();
791
} // createEntityManager():XMLEntityManager
793
/** Creates an error reporter. */
794
protected XMLErrorReporter createErrorReporter() {
795
return new XMLErrorReporter();
796
} // createErrorReporter():XMLErrorReporter
798
/** Create a document scanner. */
799
protected XMLDocumentScanner createDocumentScanner() {
801
} // createDocumentScanner():XMLDocumentScanner
803
/** Create a DTD scanner. */
804
protected XMLDTDScanner createDTDScanner() {
805
return new XMLDTDScannerImpl();
806
} // createDTDScanner():XMLDTDScanner
808
/** Create a datatype validator factory. */
809
protected DTDDVFactory createDatatypeValidatorFactory() {
810
return DTDDVFactory.getInstance();
811
} // createDatatypeValidatorFactory():DatatypeValidatorFactory
812
protected ValidationManager createValidationManager(){
813
return new ValidationManager();
816
} // class NonValidatingConfiguration