Java源码示例:com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration
示例1
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例2
private void copyFeatures1(
Enumeration<Object> features,
String featurePrefix,
XMLComponentManager from,
XMLParserConfiguration to) {
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
boolean value = from.getFeature(featureId);
try {
to.setFeature(featureId, value);
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
}
示例3
/**
* Constructs a DOM Builder using the standard parser configuration.
*/
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
this (config);
if (schemaType != null) {
if (schemaType.equals (Constants.NS_DTD)) {
//Schema validation is false by default and hence there is no
//need to set it to false here. Also, schema validation is
//not a recognized feature for DTDConfiguration's and so
//setting this feature here would result in a Configuration
//Exception.
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_DTD);
fSchemaType = Constants.NS_DTD;
}
else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
// XML Schem validation
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_XMLSCHEMA);
}
}
}
示例4
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例5
/**
* Constructs a DOM Builder using the standard parser configuration.
*/
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
this (config);
if (schemaType != null) {
if (schemaType.equals (Constants.NS_DTD)) {
//Schema validation is false by default and hence there is no
//need to set it to false here. Also, schema validation is
//not a recognized feature for DTDConfiguration's and so
//setting this feature here would result in a Configuration
//Exception.
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_DTD);
fSchemaType = Constants.NS_DTD;
}
else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
// XML Schem validation
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_XMLSCHEMA);
}
}
}
示例6
/**
* Constructs a DOM Builder using the standard parser configuration.
*/
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
this (config);
if (schemaType != null) {
if (schemaType.equals (Constants.NS_DTD)) {
//Schema validation is false by default and hence there is no
//need to set it to false here. Also, schema validation is
//not a recognized feature for DTDConfiguration's and so
//setting this feature here would result in a Configuration
//Exception.
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_DTD);
fSchemaType = Constants.NS_DTD;
}
else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
// XML Schem validation
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_XMLSCHEMA);
}
}
}
示例7
private void copyFeatures1(
Enumeration features,
String featurePrefix,
XMLComponentManager from,
XMLParserConfiguration to) {
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
boolean value = from.getFeature(featureId);
try {
to.setFeature(featureId, value);
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
}
示例8
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例9
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例10
/**
* Constructs a DOM Builder using the standard parser configuration.
*/
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
this (config);
if (schemaType != null) {
if (schemaType.equals (Constants.NS_DTD)) {
//Schema validation is false by default and hence there is no
//need to set it to false here. Also, schema validation is
//not a recognized feature for DTDConfiguration's and so
//setting this feature here would result in a Configuration
//Exception.
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_DTD);
fSchemaType = Constants.NS_DTD;
}
else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
// XML Schem validation
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_XMLSCHEMA);
}
}
}
示例11
private void copyFeatures1(
Enumeration features,
String featurePrefix,
XMLComponentManager from,
XMLParserConfiguration to) {
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
boolean value = from.getFeature(featureId);
try {
to.setFeature(featureId, value);
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
}
示例12
/**
* Constructs a DOM Builder using the standard parser configuration.
*/
public DOMParserImpl (XMLParserConfiguration config, String schemaType) {
this (config);
if (schemaType != null) {
if (schemaType.equals (Constants.NS_DTD)) {
//Schema validation is false by default and hence there is no
//need to set it to false here. Also, schema validation is
//not a recognized feature for DTDConfiguration's and so
//setting this feature here would result in a Configuration
//Exception.
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_DTD);
fSchemaType = Constants.NS_DTD;
}
else if (schemaType.equals (Constants.NS_XMLSCHEMA)) {
// XML Schem validation
fConfiguration.setProperty (
Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_LANGUAGE,
Constants.NS_XMLSCHEMA);
}
}
}
示例13
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例14
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例15
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例16
private void copyFeatures1(
Enumeration features,
String featurePrefix,
XMLComponentManager from,
XMLParserConfiguration to) {
while (features.hasMoreElements()) {
String featureId = featurePrefix + (String)features.nextElement();
boolean value = from.getFeature(featureId);
try {
to.setFeature(featureId, value);
}
catch (XMLConfigurationException e) {
// componentManager doesn't support this feature,
// so we won't worry about it
}
}
}
示例17
/** Default constructor. */
protected AbstractDOMParser (XMLParserConfiguration config) {
super (config);
// add recognized features
fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES);
// set default values
fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true);
fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true);
fConfiguration.setFeature (DEFER_NODE_EXPANSION, true);
fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true);
fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true);
// add recognized properties
fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES);
// set default values
fConfiguration.setProperty (DOCUMENT_CLASS_NAME,
DEFAULT_DOCUMENT_CLASS_NAME);
}
示例18
protected void copyFeatures(
XMLComponentManager from,
XMLParserConfiguration to) {
Enumeration features = Constants.getXercesFeatures();
copyFeatures1(features, Constants.XERCES_FEATURE_PREFIX, from, to);
features = Constants.getSAXFeatures();
copyFeatures1(features, Constants.SAX_FEATURE_PREFIX, from, to);
}
示例19
/**
* Constructs a document parser using the default symbol table
* and grammar pool.
*/
protected AbstractXMLDocumentParser(XMLParserConfiguration config) {
super(config);
// set handlers
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例20
/** Default constructor. */
public SchemaDOMParser(XMLParserConfiguration config) {
this.config = config;
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例21
/** Default constructor. */
public SchemaDOMParser(XMLParserConfiguration config) {
this.config = config;
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例22
private XMLParserConfiguration initialize() {
XML11Configuration config = new XML11Configuration();
if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
}
config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
config.setProperty(ERROR_REPORTER, errorReporter);
// add message formatters
if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
}
config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
config.setDocumentHandler(fSchemaValidator);
config.setDTDHandler(null);
config.setDTDContentModelHandler(null);
config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
config.setProperty(Constants.SECURITY_MANAGER,
fComponentManager.getProperty(Constants.SECURITY_MANAGER));
fConfiguration = new SoftReference(config);
return config;
}
示例23
/** Default constructor. */
public SchemaDOMParser(XMLParserConfiguration config) {
this.config = config;
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例24
protected void copyFeatures(
XMLComponentManager from,
XMLParserConfiguration to) {
Enumeration features = Constants.getXercesFeatures();
copyFeatures1(features, Constants.XERCES_FEATURE_PREFIX, from, to);
features = Constants.getSAXFeatures();
copyFeatures1(features, Constants.SAX_FEATURE_PREFIX, from, to);
}
示例25
/**
* Constructs a document parser using the default symbol table
* and grammar pool.
*/
protected AbstractXMLDocumentParser(XMLParserConfiguration config) {
super(config);
// set handlers
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例26
/** Default constructor. */
protected AbstractSAXParser(XMLParserConfiguration config) {
super(config);
config.addRecognizedFeatures(RECOGNIZED_FEATURES);
config.addRecognizedProperties(RECOGNIZED_PROPERTIES);
try {
config.setFeature(ALLOW_UE_AND_NOTATION_EVENTS, false);
}
catch (XMLConfigurationException e) {
// it wasn't a recognized feature, so we don't worry about it
}
}
示例27
/**
* Constructs a document parser using the default symbol table
* and grammar pool.
*/
protected AbstractXMLDocumentParser(XMLParserConfiguration config) {
super(config);
// set handlers
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例28
/**
* Constructs a document parser using the default symbol table
* and grammar pool.
*/
protected AbstractXMLDocumentParser(XMLParserConfiguration config) {
super(config);
// set handlers
config.setDocumentHandler(this);
config.setDTDHandler(this);
config.setDTDContentModelHandler(this);
}
示例29
private XMLParserConfiguration initialize() {
XML11Configuration config = new XML11Configuration();
if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
}
config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
config.setProperty(ERROR_REPORTER, errorReporter);
// add message formatters
if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
}
config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
config.setDocumentHandler(fSchemaValidator);
config.setDTDHandler(null);
config.setDTDContentModelHandler(null);
config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
config.setProperty(Constants.SECURITY_MANAGER,
fComponentManager.getProperty(Constants.SECURITY_MANAGER));
fConfiguration = new SoftReference(config);
return config;
}
示例30
/** Default constructor. */
protected AbstractSAXParser(XMLParserConfiguration config) {
super(config);
config.addRecognizedFeatures(RECOGNIZED_FEATURES);
config.addRecognizedProperties(RECOGNIZED_PROPERTIES);
try {
config.setFeature(ALLOW_UE_AND_NOTATION_EVENTS, false);
}
catch (XMLConfigurationException e) {
// it wasn't a recognized feature, so we don't worry about it
}
}