diff --git a/src/xercesc/internal/XMLScanner.cpp b/src/xercesc/internal/XMLScanner.cpp index 997b80738b08ebecb3f52a9e912067c66564081c..5271d6b8de76213731fba0dedbc1c6d79ff0bddb 100644 --- a/src/xercesc/internal/XMLScanner.cpp +++ b/src/xercesc/internal/XMLScanner.cpp @@ -161,6 +161,9 @@ XMLScanner::XMLScanner(XMLValidator* const valToAdopt, , fGenerateSyntheticAnnotations(false) , fValidateAnnotations(false) , fIgnoreCachedDTD(false) + , fIgnoreAnnotations(false) + , fDisableDefaultEntityResolution(false) + , fSkipDTDValidation(false) , fErrorCount(0) , fEntityExpansionLimit(0) , fEntityExpansionCount(0) @@ -246,6 +249,9 @@ XMLScanner::XMLScanner( XMLDocumentHandler* const docHandler , fGenerateSyntheticAnnotations(false) , fValidateAnnotations(false) , fIgnoreCachedDTD(false) + , fIgnoreAnnotations(false) + , fDisableDefaultEntityResolution(false) + , fSkipDTDValidation(false) , fErrorCount(0) , fEntityExpansionLimit(0) , fEntityExpansionCount(0) diff --git a/src/xercesc/internal/XMLScanner.hpp b/src/xercesc/internal/XMLScanner.hpp index ddf39463687245639d394c671446c6cad44a01fe..af024f2972e425edc01133dbbf5cf02b61e2535e 100644 --- a/src/xercesc/internal/XMLScanner.hpp +++ b/src/xercesc/internal/XMLScanner.hpp @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.49 2005/03/30 00:55:14 cargilld + * Begin work on adding some new features by checking in the feature handling support. + * * Revision 1.48 2005/01/06 21:39:43 amassari * Removed warnings * @@ -563,6 +566,9 @@ public : bool getGenerateSyntheticAnnotations() const; bool getValidateAnnotations() const; bool getIgnoreCachedDTD() const; + bool getIgnoreAnnotations() const; + bool getDisableDefaultEntityResolution() const; + bool getSkipDTDValidation() const; // ----------------------------------------------------------------------- // Getter methods @@ -661,6 +667,9 @@ public : void setGenerateSyntheticAnnotations(const bool newValue); void setValidateAnnotations(const bool newValue); void setIgnoredCachedDTD(const bool newValue); + void setIgnoreAnnotations(const bool newValue); + void setDisableDefaultEntityResolution(const bool newValue); + void setSkipDTDValidation(const bool newValue); // ----------------------------------------------------------------------- // Mutator methods @@ -1029,6 +1038,9 @@ protected: bool fGenerateSyntheticAnnotations; bool fValidateAnnotations; bool fIgnoreCachedDTD; + bool fIgnoreAnnotations; + bool fDisableDefaultEntityResolution; + bool fSkipDTDValidation; int fErrorCount; unsigned int fEntityExpansionLimit; unsigned int fEntityExpansionCount; @@ -1391,6 +1403,21 @@ inline bool XMLScanner::getIgnoreCachedDTD() const return fIgnoreCachedDTD; } +inline bool XMLScanner::getIgnoreAnnotations() const +{ + return fIgnoreAnnotations; +} + +inline bool XMLScanner::getDisableDefaultEntityResolution() const +{ + return fDisableDefaultEntityResolution; +} + +inline bool XMLScanner::getSkipDTDValidation() const +{ + return fSkipDTDValidation; +} + // --------------------------------------------------------------------------- // XMLScanner: Setter methods // --------------------------------------------------------------------------- @@ -1565,6 +1592,21 @@ inline void XMLScanner::setIgnoredCachedDTD(const bool newValue) fIgnoreCachedDTD = newValue; } +inline void XMLScanner::setIgnoreAnnotations(const bool newValue) +{ + fIgnoreAnnotations = newValue; +} + +inline void XMLScanner::setDisableDefaultEntityResolution(const bool newValue) +{ + fDisableDefaultEntityResolution = newValue; +} + +inline void XMLScanner::setSkipDTDValidation(const bool newValue) +{ + fSkipDTDValidation = newValue; +} + // --------------------------------------------------------------------------- // XMLScanner: Mutator methods // --------------------------------------------------------------------------- diff --git a/src/xercesc/parsers/AbstractDOMParser.cpp b/src/xercesc/parsers/AbstractDOMParser.cpp index 5bfb8808706993ff698b4dab1350a6d73a1f1037..29f8399b3de5be8872b27f5085a34b7f3e20a422 100644 --- a/src/xercesc/parsers/AbstractDOMParser.cpp +++ b/src/xercesc/parsers/AbstractDOMParser.cpp @@ -312,6 +312,20 @@ bool AbstractDOMParser::getStandardUriConformant() const return fScanner->getStandardUriConformant(); } +bool AbstractDOMParser::getIgnoreAnnotations() const +{ + return fScanner->getIgnoreAnnotations(); +} + +bool AbstractDOMParser::getDisableDefaultEntityResolution() const +{ + return fScanner->getDisableDefaultEntityResolution(); +} + +bool AbstractDOMParser::getSkipDTDValidation() const +{ + return fScanner->getSkipDTDValidation(); +} // --------------------------------------------------------------------------- // AbstractDOMParser: Setter methods @@ -449,6 +463,21 @@ void AbstractDOMParser::setCreateSchemaInfo(const bool create) fScanner->setPSVIHandler(0); } +void AbstractDOMParser::setIgnoreAnnotations(const bool newValue) +{ + fScanner->setIgnoreAnnotations(newValue); +} + +void AbstractDOMParser::setDisableDefaultEntityResolution(const bool newValue) +{ + fScanner->setDisableDefaultEntityResolution(newValue); +} + +void AbstractDOMParser::setSkipDTDValidation(const bool newValue) +{ + fScanner->setSkipDTDValidation(newValue); +} + // --------------------------------------------------------------------------- // AbstractDOMParser: Parsing methods // --------------------------------------------------------------------------- diff --git a/src/xercesc/parsers/AbstractDOMParser.hpp b/src/xercesc/parsers/AbstractDOMParser.hpp index ebe739295b7f44c0c5eab0a32fb7f258d314a696..947b0db44b769c75bb398f8adff80187e1933e8a 100644 --- a/src/xercesc/parsers/AbstractDOMParser.hpp +++ b/src/xercesc/parsers/AbstractDOMParser.hpp @@ -430,6 +430,33 @@ public : */ bool getValidateAnnotations() const; + /** Get the 'ignore annotations' flag + * + * @return true, if the parser is currently configured to + * ignore annotations, false otherwise. + * + * @see #setIgnoreAnnotations + */ + bool getIgnoreAnnotations() const; + + /** Get the 'disable default entity resolution' flag + * + * @return true, if the parser is currently configured to + * not perform default entity resolution, false otherwise. + * + * @see #setDisableDefaultEntityResolution + */ + bool getDisableDefaultEntityResolution() const; + + /** Get the 'skip DTD validation' flag + * + * @return true, if the parser is currently configured to + * skip DTD validation, false otherwise. + * + * @see #setSkipDTDValidation + */ + bool getSkipDTDValidation() const; + //@} @@ -797,6 +824,46 @@ public : */ void setCreateSchemaInfo(const bool newState); + /** Set the 'ignore annotation' flag + * + * This method gives users the option to not generate XSAnnotations + * when "traversing" a schema. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreAnnotations(const bool newValue); + + /** Set the 'disable default entity resolution' flag + * + * This method gives users the option to not perform default entity + * resolution. If the user's resolveEntity method returns NULL the + * parser will try to resolve the entity on its own. When this option + * is set to true, the parser will not attempt to resolve the entity + * when the resolveEntity method returns NULL. + * + * The parser's default state is false + * + * @param newValue The state to set + * + * @see #entityResolver + */ + void setDisableDefaultEntityResolution(const bool newValue); + + /** Set the 'skip DTD validation' flag + * + * This method gives users the option to skip DTD validation only when + * schema validation is on (i.e. when performing validation, we will + * ignore the DTD, except for entities, when schema validation is enabled). + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setSkipDTDValidation(const bool newValue); //@} diff --git a/src/xercesc/parsers/DOMBuilderImpl.cpp b/src/xercesc/parsers/DOMBuilderImpl.cpp index bbc3e411a0859cdebee5063e7ce17892b354b0c0..1000f003bf285e38baef7378c0255e952dd7a52e 100644 --- a/src/xercesc/parsers/DOMBuilderImpl.cpp +++ b/src/xercesc/parsers/DOMBuilderImpl.cpp @@ -247,6 +247,18 @@ void DOMBuilderImpl::setFeature(const XMLCh* const name, const bool state) { getScanner()->setIgnoredCachedDTD(state); } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + getScanner()->setIgnoreAnnotations(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + getScanner()->setDisableDefaultEntityResolution(state); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + getScanner()->setSkipDTDValidation(state); + } else { throw DOMException(DOMException::NOT_FOUND_ERR, 0, getMemoryManager()); } @@ -349,6 +361,18 @@ bool DOMBuilderImpl::getFeature(const XMLCh* const name) const { return getScanner()->getIgnoreCachedDTD(); } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + return getScanner()->getIgnoreAnnotations(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + return getScanner()->getDisableDefaultEntityResolution(); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + return getScanner()->getSkipDTDValidation(); + } else { throw DOMException(DOMException::NOT_FOUND_ERR, 0, getMemoryManager()); } @@ -373,7 +397,10 @@ bool DOMBuilderImpl::canSetFeature(const XMLCh* const name, const bool state) co (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidateAnnotations) == 0) || (XMLString::compareIStringASCII(name, XMLUni::fgXercesGenerateSyntheticAnnotations) == 0) || (XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) || - (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) + (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) || + (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) || + (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) || + (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) ) { return true; } diff --git a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp index 93761d87980a66187379d7aa276b7ce6be36d494..a1484f28f2e74c2a7802afcd2352778caa1d7c71 100644 --- a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp +++ b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.45 2005/03/30 00:55:13 cargilld + * Begin work on adding some new features by checking in the feature handling support. + * * Revision 1.44 2005/03/20 19:02:45 cargilld * Implement versions of uppercase and compareIstring that only check a to z, instead of all characters, and don't rely on functionality provided in the transcoders. * @@ -1577,6 +1580,18 @@ void SAX2XMLReaderImpl::setFeature(const XMLCh* const name, const bool value) { fScanner->setIgnoredCachedDTD(value); } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + { + fScanner->setIgnoreAnnotations(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + { + fScanner->setDisableDefaultEntityResolution(value); + } + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + { + fScanner->setSkipDTDValidation(value); + } else throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); } @@ -1617,6 +1632,12 @@ bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const return fScanner->getValidateAnnotations(); else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreCachedDTD) == 0) return fScanner->getIgnoreCachedDTD(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesIgnoreAnnotations) == 0) + return fScanner->getIgnoreAnnotations(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesDisableDefaultEntityResolution) == 0) + return fScanner->getDisableDefaultEntityResolution(); + else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesSkipDTDValidation) == 0) + return fScanner->getSkipDTDValidation(); else throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); diff --git a/src/xercesc/parsers/SAXParser.cpp b/src/xercesc/parsers/SAXParser.cpp index 1ed874f1a6388332ef3a42ebb7b0aa1aaa361bcf..27daf0254b2da362dc2c12a92bbf57d1e5426418 100644 --- a/src/xercesc/parsers/SAXParser.cpp +++ b/src/xercesc/parsers/SAXParser.cpp @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.39 2005/03/30 00:55:14 cargilld + * Begin work on adding some new features by checking in the feature handling support. + * * Revision 1.38 2004/12/30 15:23:41 amassari * Notify advanced handlers of the whitespace before and after the root document element (jira# 729) * @@ -580,6 +583,21 @@ bool SAXParser::getIgnoreCachedDTD() const return fScanner->getIgnoreCachedDTD(); } +bool SAXParser::getIgnoreAnnotations() const +{ + return fScanner->getIgnoreAnnotations(); +} + +bool SAXParser::getDisableDefaultEntityResolution() const +{ + return fScanner->getDisableDefaultEntityResolution(); +} + +bool SAXParser::getSkipDTDValidation() const +{ + return fScanner->getSkipDTDValidation(); +} + // --------------------------------------------------------------------------- // SAXParser: Setter methods // --------------------------------------------------------------------------- @@ -721,6 +739,21 @@ void SAXParser::setIgnoreCachedDTD(const bool newValue) fScanner->setIgnoredCachedDTD(newValue); } +void SAXParser::setIgnoreAnnotations(const bool newValue) +{ + fScanner->setIgnoreAnnotations(newValue); +} + +void SAXParser::setDisableDefaultEntityResolution(const bool newValue) +{ + fScanner->setDisableDefaultEntityResolution(newValue); +} + +void SAXParser::setSkipDTDValidation(const bool newValue) +{ + fScanner->setSkipDTDValidation(newValue); +} + // --------------------------------------------------------------------------- // SAXParser: Overrides of the SAX Parser interface // --------------------------------------------------------------------------- diff --git a/src/xercesc/parsers/SAXParser.hpp b/src/xercesc/parsers/SAXParser.hpp index 5073fef4514c4807b6d9f952c7c38081cc6e5286..66037656058da65ad7ab952e4b21d811751a255a 100644 --- a/src/xercesc/parsers/SAXParser.hpp +++ b/src/xercesc/parsers/SAXParser.hpp @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.39 2005/03/30 00:55:14 cargilld + * Begin work on adding some new features by checking in the feature handling support. + * * Revision 1.38 2005/03/09 16:07:10 amassari * Protected getSrcOffset to avoid crashing when parsing has finished; updated documentation * @@ -697,6 +700,33 @@ public : */ bool getIgnoreCachedDTD() const; + /** Get the 'ignore annotations' flag + * + * @return true, if the parser is currently configured to + * ignore annotations, false otherwise. + * + * @see #setIgnoreAnnotations + */ + bool getIgnoreAnnotations() const; + + /** Get the 'disable default entity resolution' flag + * + * @return true, if the parser is currently configured to + * not perform default entity resolution, false otherwise. + * + * @see #setDisableDefaultEntityResolution + */ + bool getDisableDefaultEntityResolution() const; + + /** Get the 'skip DTD validation' flag + * + * @return true, if the parser is currently configured to + * skip DTD validation, false otherwise. + * + * @see #setSkipDTDValidation + */ + bool getSkipDTDValidation() const; + //@} @@ -1041,6 +1071,46 @@ public : */ void setIgnoreCachedDTD(const bool newValue); + /** Set the 'ignore annotation' flag + * + * This method gives users the option to not generate XSAnnotations + * when "traversing" a schema. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setIgnoreAnnotations(const bool newValue); + + /** Set the 'disable default entity resolution' flag + * + * This method gives users the option to not perform default entity + * resolution. If the user's resolveEntity method returns NULL the + * parser will try to resolve the entity on its own. When this option + * is set to true, the parser will not attempt to resolve the entity + * when the resolveEntity method returns NULL. + * + * The parser's default state is false + * + * @param newValue The state to set + * + * @see #entityResolver + */ + void setDisableDefaultEntityResolution(const bool newValue); + + /** Set the 'skip DTD validation' flag + * + * This method gives users the option to skip DTD validation only when + * schema validation is on (i.e. when performing validation, we will + * ignore the DTD, except for entities, when schema validation is enabled). + * + * NOTE: This option is ignored if schema validation is disabled. + * + * The parser's default state is false + * + * @param newValue The state to set + */ + void setSkipDTDValidation(const bool newValue); //@} diff --git a/src/xercesc/util/XMLUni.cpp b/src/xercesc/util/XMLUni.cpp index 6abec93d4dae4bb6325af4143033ce042a8b2dda..4d5da295b84fbcddd0e8ab19ffb061d715d91e68 100644 --- a/src/xercesc/util/XMLUni.cpp +++ b/src/xercesc/util/XMLUni.cpp @@ -1273,6 +1273,53 @@ const XMLCh XMLUni::fgXercesIgnoreCachedDTD[] = , chLatin_D, chLatin_T, chLatin_D, chNull }; +//Xerces: http://apache.org/xml/features/schema/ignore-annotations +const XMLCh XMLUni::fgXercesIgnoreAnnotations[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h + , chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash + , chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chLatin_f, chLatin_e + , chLatin_a, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s + , chForwardSlash, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m + , chLatin_a, chForwardSlash, chLatin_i, chLatin_g, chLatin_n, chLatin_o + , chLatin_r, chLatin_e, chDash + , chLatin_a, chLatin_n, chLatin_n, chLatin_o, chLatin_t, chLatin_a, chLatin_t + , chLatin_i, chLatin_o, chLatin_n, chLatin_s, chNull +}; + +//Xerces: http://apache.org/xml/features/disable-default-entity-resolution +const XMLCh XMLUni::fgXercesDisableDefaultEntityResolution[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h + , chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash + , chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chLatin_f, chLatin_e + , chLatin_a, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s + , chForwardSlash, chLatin_d, chLatin_i, chLatin_s, chLatin_a, chLatin_b + , chLatin_l, chLatin_e, chDash, chLatin_d, chLatin_e, chLatin_f + , chLatin_a, chLatin_u, chLatin_l, chLatin_t, chDash, chLatin_e + , chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chDash + , chLatin_r, chLatin_e, chLatin_s, chLatin_o, chLatin_l, chLatin_u + , chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +//Xerces: http://apache.org/xml/features/validation/schema/skip-dtd-validation +const XMLCh XMLUni::fgXercesSkipDTDValidation[] = +{ + chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash + , chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h + , chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash + , chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chLatin_f, chLatin_e + , chLatin_a, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s + , chForwardSlash, chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d + , chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chForwardSlash + , chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a + , chForwardSlash, chLatin_s, chLatin_k, chLatin_i, chLatin_p, chDash + , chLatin_d, chLatin_t, chLatin_d, chDash, chLatin_v, chLatin_a + , chLatin_l, chLatin_i, chLatin_d, chLatin_a, chLatin_t, chLatin_i + , chLatin_o, chLatin_n, chNull +}; //Introduced in DOM Level 3 const XMLCh XMLUni::fgDOMCanonicalForm[] = diff --git a/src/xercesc/util/XMLUni.hpp b/src/xercesc/util/XMLUni.hpp index eedf8b07150d0293ca5c70b4aff0ff03c612e1a9..fd94e44dcf0e3b3ccab54fe351a48576600f3169 100644 --- a/src/xercesc/util/XMLUni.hpp +++ b/src/xercesc/util/XMLUni.hpp @@ -224,6 +224,9 @@ public : static const XMLCh fgXercesGenerateSyntheticAnnotations[]; static const XMLCh fgXercesValidateAnnotations[]; static const XMLCh fgXercesIgnoreCachedDTD[]; + static const XMLCh fgXercesIgnoreAnnotations[]; + static const XMLCh fgXercesDisableDefaultEntityResolution[]; + static const XMLCh fgXercesSkipDTDValidation[]; // SAX2 features/properties names