From 4d746bbd9e4b1cbb59351e1ed2ce1dd9ab6a09f2 Mon Sep 17 00:00:00 2001 From: PeiYong Zhang <peiyongz@apache.org> Date: Tue, 13 Apr 2004 16:53:26 +0000 Subject: [PATCH] get/setIdentityConstraintChecking git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175866 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/dom/deprecated/DOMParser.cpp | 10 ++++++++ src/xercesc/dom/deprecated/DOMParser.hpp | 4 ++++ src/xercesc/parsers/AbstractDOMParser.cpp | 10 ++++++++ src/xercesc/parsers/AbstractDOMParser.hpp | 27 ++++++++++++++++++++++ src/xercesc/parsers/DOMBuilderImpl.cpp | 5 ++++ src/xercesc/parsers/SAX2XMLReaderImpl.cpp | 9 ++++++++ src/xercesc/parsers/SAXParser.cpp | 13 +++++++++++ src/xercesc/parsers/SAXParser.hpp | 28 +++++++++++++++++++++++ 8 files changed, 106 insertions(+) diff --git a/src/xercesc/dom/deprecated/DOMParser.cpp b/src/xercesc/dom/deprecated/DOMParser.cpp index 163dcb53a..9dd9e3e94 100644 --- a/src/xercesc/dom/deprecated/DOMParser.cpp +++ b/src/xercesc/dom/deprecated/DOMParser.cpp @@ -244,6 +244,11 @@ bool DOMParser::getValidationSchemaFullChecking() const return fScanner->getValidationSchemaFullChecking(); } +bool DOMParser::getIdentityConstraintChecking() const +{ + return fScanner->getIdentityConstraintChecking(); +} + int DOMParser::getErrorCount() const { return fScanner->getErrorCount(); @@ -385,6 +390,11 @@ void DOMParser::setValidationSchemaFullChecking(const bool schemaFullChecking) fScanner->setValidationSchemaFullChecking(schemaFullChecking); } +void DOMParser::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fScanner->setIdentityConstraintChecking(identityConstraintChecking); +} + void DOMParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) { fScanner->setExternalSchemaLocation(schemaLocation); diff --git a/src/xercesc/dom/deprecated/DOMParser.hpp b/src/xercesc/dom/deprecated/DOMParser.hpp index 146e51de8..57e61566b 100644 --- a/src/xercesc/dom/deprecated/DOMParser.hpp +++ b/src/xercesc/dom/deprecated/DOMParser.hpp @@ -293,6 +293,8 @@ public : */ bool getValidationSchemaFullChecking() const; + bool getIdentityConstraintChecking() const; + /** Get error count from the last parse operation. * * This method returns the error count from the last parse @@ -726,6 +728,8 @@ public : */ void setValidationSchemaFullChecking(const bool schemaFullChecking); + void setIdentityConstraintChecking(const bool identityConstraintChecking); + /** * This method allows users to set the toCreateXMLDeclTypeNode flag * by this parser. By setting it to 'true' user can have XMLDecl type diff --git a/src/xercesc/parsers/AbstractDOMParser.cpp b/src/xercesc/parsers/AbstractDOMParser.cpp index 194184a4d..5ad30251f 100644 --- a/src/xercesc/parsers/AbstractDOMParser.cpp +++ b/src/xercesc/parsers/AbstractDOMParser.cpp @@ -297,6 +297,11 @@ bool AbstractDOMParser::getValidationSchemaFullChecking() const return fScanner->getValidationSchemaFullChecking(); } +bool AbstractDOMParser::getIdentityConstraintChecking() const +{ + return fScanner->getIdentityConstraintChecking(); +} + int AbstractDOMParser::getErrorCount() const { return fScanner->getErrorCount(); @@ -383,6 +388,11 @@ void AbstractDOMParser::setValidationSchemaFullChecking(const bool schemaFullChe fScanner->setValidationSchemaFullChecking(schemaFullChecking); } +void AbstractDOMParser::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fScanner->setIdentityConstraintChecking(identityConstraintChecking); +} + void AbstractDOMParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) { fScanner->setExternalSchemaLocation(schemaLocation); diff --git a/src/xercesc/parsers/AbstractDOMParser.hpp b/src/xercesc/parsers/AbstractDOMParser.hpp index 709db1364..b8af88452 100644 --- a/src/xercesc/parsers/AbstractDOMParser.hpp +++ b/src/xercesc/parsers/AbstractDOMParser.hpp @@ -225,6 +225,18 @@ public : */ bool getValidationSchemaFullChecking() const; + /** Get the identity constraint checking' flag + * + * This method returns the state of the parser's identity constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have identity constraint checking, false otherwise. + * + * @see setIdentityConstraintChecking + */ + bool getIdentityConstraintChecking() const; + /** Get error count from the last parse operation. * * This method returns the error count from the last parse @@ -583,6 +595,21 @@ public : */ void setValidationSchemaFullChecking(const bool schemaFullChecking); + /** + * This method allows users to enable or disable the parser's identity + * constraint checks. + * + * <p>By default, the parser does not to any identity constraint checks. + * The default value is false.</p> + * + * @param newState The value specifying whether the parser should + * do identity constraint checks or not in the + * input XML document. + * + * @see #getIdentityConstraintChecking + */ + void setIdentityConstraintChecking(const bool newState); + /** * This method allows the user to specify a list of schemas to use. * If the targetNamespace of a schema specified using this method matches diff --git a/src/xercesc/parsers/DOMBuilderImpl.cpp b/src/xercesc/parsers/DOMBuilderImpl.cpp index 0d48d2450..11ea396e0 100644 --- a/src/xercesc/parsers/DOMBuilderImpl.cpp +++ b/src/xercesc/parsers/DOMBuilderImpl.cpp @@ -317,6 +317,11 @@ bool DOMBuilderImpl::getFeature(const XMLCh* const name) const return getValidationSchemaFullChecking(); } + else if (XMLString::compareIString(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + { + return getIdentityConstraintChecking(); + } + else if (XMLString::compareIString(name, XMLUni::fgXercesLoadExternalDTD) == 0) { return getLoadExternalDTD(); diff --git a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp index 7494ff8b5..413dd13ce 100644 --- a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp +++ b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.34 2004/04/13 16:53:26 peiyongz + * get/setIdentityConstraintChecking + * * Revision 1.33 2004/01/29 11:46:32 cargilld * Code cleanup changes to get rid of various compiler diagnostic messages. * @@ -1555,6 +1558,10 @@ void SAX2XMLReaderImpl::setFeature(const XMLCh* const name, const bool value) { fScanner->setValidationSchemaFullChecking(value); } + else if (XMLString::compareIString(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + { + fScanner->setIdentityConstraintChecking(value); + } else if (XMLString::compareIString(name, XMLUni::fgXercesLoadExternalDTD) == 0) { fScanner->setLoadExternalDTD(value); @@ -1605,6 +1612,8 @@ bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const return getDoSchema(); else if (XMLString::compareIString(name, XMLUni::fgXercesSchemaFullChecking) == 0) return fScanner->getValidationSchemaFullChecking(); + else if (XMLString::compareIString(name, XMLUni::fgXercesIdentityConstraintChecking) == 0) + return fScanner->getIdentityConstraintChecking(); else if (XMLString::compareIString(name, XMLUni::fgXercesLoadExternalDTD) == 0) return fScanner->getLoadExternalDTD(); else if (XMLString::compareIString(name, XMLUni::fgXercesContinueAfterFatalError) == 0) diff --git a/src/xercesc/parsers/SAXParser.cpp b/src/xercesc/parsers/SAXParser.cpp index 24c62355d..d0c89dfff 100644 --- a/src/xercesc/parsers/SAXParser.cpp +++ b/src/xercesc/parsers/SAXParser.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.32 2004/04/13 16:53:26 peiyongz + * get/setIdentityConstraintChecking + * * Revision 1.31 2004/01/29 11:46:32 cargilld * Code cleanup changes to get rid of various compiler diagnostic messages. * @@ -514,6 +517,11 @@ bool SAXParser::getValidationSchemaFullChecking() const return fScanner->getValidationSchemaFullChecking(); } +bool SAXParser::getIdentityConstraintChecking() const +{ + return fScanner->getIdentityConstraintChecking(); +} + int SAXParser::getErrorCount() const { return fScanner->getErrorCount(); @@ -620,6 +628,11 @@ void SAXParser::setValidationSchemaFullChecking(const bool schemaFullChecking) fScanner->setValidationSchemaFullChecking(schemaFullChecking); } +void SAXParser::setIdentityConstraintChecking(const bool identityConstraintChecking) +{ + fScanner->setIdentityConstraintChecking(identityConstraintChecking); +} + void SAXParser::setExternalSchemaLocation(const XMLCh* const schemaLocation) { fScanner->setExternalSchemaLocation(schemaLocation); diff --git a/src/xercesc/parsers/SAXParser.hpp b/src/xercesc/parsers/SAXParser.hpp index 695b0a94a..5dff3363d 100644 --- a/src/xercesc/parsers/SAXParser.hpp +++ b/src/xercesc/parsers/SAXParser.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.29 2004/04/13 16:53:26 peiyongz + * get/setIdentityConstraintChecking + * * Revision 1.28 2003/12/01 23:23:26 neilg * fix for bug 25118; thanks to Jeroen Witmond * @@ -461,6 +464,18 @@ public : */ bool getValidationSchemaFullChecking() const; + /** Get the 'identity constraint checking' flag + * + * This method returns the state of the parser's identity constraint + * checking flag. + * + * @return true, if the parser is currently configured to + * have identity constraint checking, false otherwise. + * + * @see #setIdentityConstraintChecking + */ + bool getIdentityConstraintChecking() const; + /** Get error count from the last parse operation. * * This method returns the error count from the last parse @@ -735,6 +750,19 @@ public : */ void setValidationSchemaFullChecking(const bool schemaFullChecking); + /** + * This method allows the user to turn identity constraint checking on/off. + * Only takes effect if Schema validation is enabled. + * If turned off, identity constraint checking is not done. + * + * The parser's default state is: false. + * + * @param identityConstraintChecking True to turn on identity constraint checking. + * + * @see #getIdentityConstraintChecking + */ + void setIdentityConstraintChecking(const bool identityConstraintChecking); + /** * This method allows users to set the parser's behaviour when it * encounters the first fatal error. If set to true, the parser -- GitLab