You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2001/06/21 16:26:03 UTC
cvs commit: xml-xerces/c/src/validators/DTD DTDScanner.cpp DTDScanner.hpp
knoaman 01/06/21 07:26:03
Modified: c/src/validators/DTD DTDScanner.cpp DTDScanner.hpp
Log:
Fix for bug 1946
Revision Changes Path
1.9 +12 -0 xml-xerces/c/src/validators/DTD/DTDScanner.cpp
Index: DTDScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/DTD/DTDScanner.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DTDScanner.cpp 2001/06/04 13:25:50 1.8
+++ DTDScanner.cpp 2001/06/21 14:25:53 1.9
@@ -56,6 +56,9 @@
/*
* $Log: DTDScanner.cpp,v $
+ * Revision 1.9 2001/06/21 14:25:53 knoaman
+ * Fix for bug 1946
+ *
* Revision 1.8 2001/06/04 13:25:50 tng
* the start tag "<?xml" could be followed by (#x20 | #x9 | #xD | #xA)+. Fixed by Pei Yong Zhang.
*
@@ -158,6 +161,7 @@
, fDTDGrammar(dtdGrammar)
, fPEntityDeclPool(0)
, fEntityDeclPool(entityDeclPool)
+ , fDocTypeReaderId(0)
{
fPEntityDeclPool = new NameIdPool<DTDEntityDecl>(109);
}
@@ -443,6 +447,7 @@
//
decl = new DTDAttDef(bufToUse.getRawBuffer());
decl->setId(fNextAttrId++);
+ decl->setExternalAttDeclaration(isReadingExternalEntity());
parentElem.addAttDef(decl);
}
@@ -619,6 +624,7 @@
//
elemDecl = new DTDElementDecl(bbName.getRawBuffer(), fEmptyNamespaceId);
elemDecl->setCreateReason(XMLElementDecl::AttList);
+ elemDecl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->putElemDecl((XMLElementDecl*) elemDecl);
}
@@ -1066,6 +1072,7 @@
{
decl = new DTDElementDecl(bufToUse.getRawBuffer(), fEmptyNamespaceId);
decl->setCreateReason(XMLElementDecl::InContentModel);
+ decl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->putElemDecl(decl);
}
curNode = new ContentSpecNode(decl->getElementName());
@@ -1235,8 +1242,10 @@
{
decl = new DTDElementDecl(bufToUse.getRawBuffer(), fEmptyNamespaceId);
decl->setCreateReason(XMLElementDecl::InContentModel);
+ decl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->putElemDecl(decl);
}
+
ContentSpecNode* tmpLeaf = new ContentSpecNode(decl->getElementName());
// Check for a repetition character after the leaf
@@ -1583,6 +1592,7 @@
{
rootDecl = new DTDElementDecl(bbRootName.getRawBuffer(), fEmptyNamespaceId);
rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
+ rootDecl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->setRootElemId(fDTDGrammar->putElemDecl(rootDecl));
}
@@ -1829,6 +1839,7 @@
// the decl pool.
//
decl = new DTDElementDecl(bbName.getRawBuffer(), fEmptyNamespaceId);
+ decl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->putElemDecl(decl);
}
@@ -3325,6 +3336,7 @@
{
decl = new DTDElementDecl(nameBuf.getRawBuffer(), fEmptyNamespaceId);
decl->setCreateReason(XMLElementDecl::InContentModel);
+ decl->setExternalElemDeclaration(isReadingExternalEntity());
fDTDGrammar->putElemDecl(decl);
}
1.4 +19 -0 xml-xerces/c/src/validators/DTD/DTDScanner.hpp
Index: DTDScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/DTD/DTDScanner.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DTDScanner.hpp 2001/05/11 13:27:10 1.3
+++ DTDScanner.hpp 2001/06/21 14:25:56 1.4
@@ -56,6 +56,9 @@
/*
* $Log: DTDScanner.hpp,v $
+ * Revision 1.4 2001/06/21 14:25:56 knoaman
+ * Fix for bug 1946
+ *
* Revision 1.3 2001/05/11 13:27:10 tng
* Copyright update.
*
@@ -209,6 +212,7 @@
bool scanPublicLiteral(XMLBuffer& toFill);
bool scanSystemLiteral(XMLBuffer& toFill);
void scanTextDecl();
+ bool isReadingExternalEntity();
// -----------------------------------------------------------------------
@@ -264,6 +268,11 @@
//
// fEmptyNamespaceId
// The uri for all DTD decls
+ //
+ // fDocTypeReaderId
+ // The original reader in the fReaderMgr - to be compared against the
+ // current reader to decide whether we are processing an external/internal
+ // declaration
// -----------------------------------------------------------------------
DocTypeHandler* fDocTypeHandler;
DTDAttDef* fDumAttDef;
@@ -278,6 +287,7 @@
NameIdPool<DTDEntityDecl>* fPEntityDeclPool;
NameIdPool<DTDEntityDecl>* fEntityDeclPool;
unsigned int fEmptyNamespaceId;
+ unsigned int fDocTypeReaderId;
};
@@ -320,5 +330,14 @@
else
fEmptyNamespaceId = 0;
+ fDocTypeReaderId = fReaderMgr->getCurrentReaderNum();
}
+
+// -----------------------------------------------------------------------
+// Helper methods
+// -----------------------------------------------------------------------
+inline bool DTDScanner::isReadingExternalEntity() {
+ return (fDocTypeReaderId != fReaderMgr->getCurrentReaderNum());
+}
+
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org