You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2005/10/12 15:19:38 UTC
svn commit: r314890 - in /xerces/c/trunk/src/xercesc/internal:
IGXMLScanner.cpp SGXMLScanner.cpp ValidationContextImpl.cpp
ValidationContextImpl.hpp XMLScanner.cpp
Author: cargilld
Date: Wed Oct 12 06:19:35 2005
New Revision: 314890
URL: http://svn.apache.org/viewcvs?rev=314890&view=rev
Log:
QName fix. Need to verify that the prefix is defined.
Modified:
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.cpp
xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.hpp
xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=314890&r1=314889&r2=314890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Wed Oct 12 06:19:35 2005
@@ -956,11 +956,11 @@
if(fGrammarType == Grammar::SchemaGrammarType)
{
elemName = fElemStack.getCurrentSchemaElemName();
- topElem = fElemStack.popTop();
+ topElem = fElemStack.topElement();
}
else
{
- topElem = fElemStack.popTop();
+ topElem = fElemStack.topElement();
elemName = topElem->fThisElement->getFullName();
}
if (!fReaderMgr.skippedString(elemName))
@@ -971,11 +971,9 @@
, elemName
);
fReaderMgr.skipPastChar(chCloseAngle);
+ fElemStack.popTop();
return;
- }
-
- // See if it was the root element, to avoid multiple calls below
- const bool isRoot = fElemStack.isEmpty();
+ }
// Make sure we are back on the same reader as where we started
if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum())
@@ -1075,7 +1073,6 @@
, topElem->fThisElement->getFullName()
);
}
-
int res = fValidator->checkContent
(
topElem->fThisElement
@@ -1118,7 +1115,7 @@
}
- if (fGrammarType == Grammar::SchemaGrammarType) {
+ if (fGrammarType == Grammar::SchemaGrammarType) {
if (((SchemaValidator*) fValidator)->getErrorOccurred())
fPSVIElemContext.fErrorOccurred = true;
else if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union)
@@ -1143,6 +1140,12 @@
}
}
+
+ // QName dv needed topElem to resolve URIs on the checkContent
+ fElemStack.popTop();
+
+ // See if it was the root element, to avoid multiple calls below
+ const bool isRoot = fElemStack.isEmpty();
if (fGrammarType == Grammar::SchemaGrammarType)
{
Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=314890&r1=314889&r2=314890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Wed Oct 12 06:19:35 2005
@@ -854,7 +854,7 @@
// Make sure that its the end of the element that we expect
const XMLCh *elemName = fElemStack.getCurrentSchemaElemName();
- const ElemStack::StackElem* topElem = fElemStack.popTop();
+ const ElemStack::StackElem* topElem = fElemStack.topElement();
if (!fReaderMgr.skippedString(elemName))
{
emitError
@@ -863,12 +863,10 @@
, elemName
);
fReaderMgr.skipPastChar(chCloseAngle);
+ fElemStack.popTop();
return;
}
- // See if it was the root element, to avoid multiple calls below
- const bool isRoot = fElemStack.isEmpty();
-
fPSVIElemContext.fErrorOccurred = fErrorStack->pop();
// Make sure we are back on the same reader as where we started
@@ -981,6 +979,13 @@
}
}
+
+ // QName dv needed topElem to resolve URIs on the checkContent
+ fElemStack.popTop();
+
+ // See if it was the root element, to avoid multiple calls below
+ const bool isRoot = fElemStack.isEmpty();
+
if (fPSVIHandler)
{
endElementPSVI
Modified: xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.cpp?rev=314890&r1=314889&r2=314890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.cpp Wed Oct 12 06:19:35 2005
@@ -26,12 +26,14 @@
#include <xercesc/framework/XMLRefInfo.hpp>
#include <xercesc/validators/DTD/DTDEntityDecl.hpp>
#include <xercesc/validators/datatype/InvalidDatatypeValueException.hpp>
+#include <xercesc/internal/ElemStack.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// Constructor and Destructor
// ---------------------------------------------------------------------------
+
ValidationContextImpl::~ValidationContextImpl()
{
if (fIdRefList)
@@ -44,6 +46,7 @@
,fEntityDeclPool(0)
,fToCheckIdRefList(true)
,fValidatingMemberType(0)
+,fElemStack(0)
{
fIdRefList = new (fMemoryManager) RefHashTableOf<XMLRefInfo>(109, fMemoryManager);
}
@@ -172,6 +175,19 @@
);
}
+}
+
+/* QName
+ */
+bool ValidationContextImpl::isPrefixUnknown(XMLCh* prefix) {
+ bool unknown = false;
+ if (XMLString::equals(prefix, XMLUni::fgXMLNSString)) {
+ return true;
+ }
+ else if (!XMLString::equals(prefix, XMLUni::fgXMLString)) {
+ unsigned int uriId = fElemStack->mapPrefixToURI(prefix, (ElemStack::MapModes) ElemStack::Mode_Element, unknown);
+ }
+ return unknown;
}
XERCES_CPP_NAMESPACE_END
Modified: xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.hpp?rev=314890&r1=314889&r2=314890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/ValidationContextImpl.hpp Wed Oct 12 06:19:35 2005
@@ -24,6 +24,7 @@
#include <xercesc/framework/ValidationContext.hpp>
XERCES_CPP_NAMESPACE_BEGIN
+class ElemStack;
class XMLPARSER_EXPORT ValidationContextImpl : public ValidationContext
{
@@ -83,6 +84,13 @@
virtual DatatypeValidator * getValidatingMemberType() const;
virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) ;
+ /**
+ * QName datatype handling
+ * Create default implementations for source code compatibility
+ */
+ virtual bool isPrefixUnknown(XMLCh* prefix);
+ virtual void setElemStack(ElemStack* elemStack);
+
//@}
private:
@@ -113,12 +121,15 @@
// own this object, and the value of getValidatingMemberType
// will not be accurate unless the type of the most recently-validated
// element/attribute is in fact a union datatype.
+ // fElemStack
+ // Need access to elemstack to look up URI's that are inscope.
// -----------------------------------------------------------------------
RefHashTableOf<XMLRefInfo>* fIdRefList;
const NameIdPool<DTDEntityDecl>* fEntityDeclPool;
bool fToCheckIdRefList;
- DatatypeValidator * fValidatingMemberType;
+ DatatypeValidator * fValidatingMemberType;
+ ElemStack* fElemStack;
};
@@ -132,6 +143,10 @@
inline void ValidationContextImpl::setValidatingMemberType(DatatypeValidator * validatingMemberType)
{
fValidatingMemberType = validatingMemberType;
+}
+
+inline void ValidationContextImpl::setElemStack(ElemStack* elemStack) {
+ fElemStack = elemStack;
}
XERCES_CPP_NAMESPACE_END
Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp?rev=314890&r1=314889&r2=314890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp Wed Oct 12 06:19:35 2005
@@ -750,6 +750,7 @@
// Create the id ref list. This is used to enforce XML 1.0 ID ref
// semantics, i.e. all id refs must refer to elements that exist
fValidationContext = new (fMemoryManager) ValidationContextImpl(fMemoryManager);
+ fValidationContext->setElemStack(&fElemStack);
// Create the GrammarResolver
//fGrammarResolver = new GrammarResolver();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org