diff --git a/src/validators/DTD/DTDElementDecl.cpp b/src/validators/DTD/DTDElementDecl.cpp index 9e105799a57cdaaa6f596b3d4202fdfcbde51bbb..76aebd4020182eb06774c775fa68ab6fbf350cbf 100644 --- a/src/validators/DTD/DTDElementDecl.cpp +++ b/src/validators/DTD/DTDElementDecl.cpp @@ -359,11 +359,13 @@ XMLContentModel* DTDElementDecl::createChildModel() ThrowXML(RuntimeException, XMLExcepts::CM_UnknownCMSpecType); // - // Do a sanity check that the node is does not have a PCDATA id. Since, + // Do a sanity check that the node does not have a PCDATA id. Since, // if it was, it should have already gotten taken by the Mixed model. // - if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) - ThrowXML(RuntimeException, XMLExcepts::CM_NoPCDATAHere); + if (specNode->getElement()) { + if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) + ThrowXML(RuntimeException, XMLExcepts::CM_NoPCDATAHere); + } // // According to the type of node, we will create the correct type of diff --git a/src/validators/common/ContentSpecNode.cpp b/src/validators/common/ContentSpecNode.cpp index 8de61584ef857d7a29c04dac280a1b06889f4c9a..7b58b45bb2b28bd1e6d34a3eaab168a9185a8707 100644 --- a/src/validators/common/ContentSpecNode.cpp +++ b/src/validators/common/ContentSpecNode.cpp @@ -84,7 +84,7 @@ ContentSpecNode::ContentSpecNode(const ContentSpecNode& toCopy) if (tempElement) fElement = new QName(tempElement); else - fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId); + fElement = 0; const ContentSpecNode *tmp = toCopy.getFirst(); if (tmp) diff --git a/src/validators/common/ContentSpecNode.hpp b/src/validators/common/ContentSpecNode.hpp index 7979855dc6c8122f473420fbc0f8272fb6038917..847cde5a337d634c7cd5329b2f49ba6c566bb64e 100644 --- a/src/validators/common/ContentSpecNode.hpp +++ b/src/validators/common/ContentSpecNode.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.17 2001/11/07 21:12:15 tng + * Performance: Create QName in ContentSpecNode only if it is a leaf/Any*/PCDataNode. + * * Revision 1.16 2001/08/28 20:21:08 peiyongz * * AIX 4.2, xlC 3 rev.1 compilation error: get*() declared with external linkage * and called or defined before being declared as inline @@ -230,8 +233,8 @@ private : // Private Data Members // // fElement - // If the type is Leaf, then this is the qName of the element. If the URI - // is fgPCDataElemId, then its a PCData node. + // If the type is Leaf/Any*, then this is the qName of the element. If the URI + // is fgPCDataElemId, then its a PCData node. Else, it is zero. // // fFirst // fSecond @@ -286,7 +289,6 @@ inline ContentSpecNode::ContentSpecNode() : , fMinOccurs(1) , fMaxOccurs(1) { - fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId); } inline @@ -301,9 +303,7 @@ ContentSpecNode::ContentSpecNode(QName* const element) : , fMinOccurs(1) , fMaxOccurs(1) { - if (!element) - fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId); - else + if (element) fElement = new QName(element); } @@ -323,7 +323,6 @@ ContentSpecNode::ContentSpecNode(const NodeTypes type , fMinOccurs(1) , fMaxOccurs(1) { - fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId); } @@ -420,7 +419,9 @@ inline bool ContentSpecNode::isSecondAdopted() const inline void ContentSpecNode::setElement(QName* const element) { delete fElement; - fElement = new QName(element); + fElement = 0; + if (element) + fElement = new QName(element); } inline void ContentSpecNode::setFirst(ContentSpecNode* const toAdopt) diff --git a/src/validators/schema/ComplexTypeInfo.cpp b/src/validators/schema/ComplexTypeInfo.cpp index c4978d9b7d928c001192b99d8eff5469a4374f73..b7c16727794641d78771cb86e46c55205197a689 100644 --- a/src/validators/schema/ComplexTypeInfo.cpp +++ b/src/validators/schema/ComplexTypeInfo.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.21 2001/11/07 21:12:15 tng + * Performance: Create QName in ContentSpecNode only if it is a leaf/Any*/PCDataNode. + * * Revision 1.20 2001/10/12 18:08:57 tng * make sure the second node exists before calling getType * @@ -434,8 +437,10 @@ XMLContentModel* ComplexTypeInfo::createChildModel(ContentSpecNode* specNode, co // Do a sanity check that the node is does not have a PCDATA id. Since, // if it was, it should have already gotten taken by the Mixed model. // - if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) - ThrowXML(RuntimeException, XMLExcepts::CM_NoPCDATAHere); + if (specNode->getElement()) { + if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) + ThrowXML(RuntimeException, XMLExcepts::CM_NoPCDATAHere); + } // // According to the type of node, we will create the correct type of @@ -540,9 +545,11 @@ ComplexTypeInfo::convertContentSpecTree(ContentSpecNode* const curNode, // When checking Unique Particle Attribution, rename leaf elements if (checkUPA) { - fContentSpecOrgURI[fUniqueURI] = curNode->getElement()->getURI(); - curNode->getElement()->setURI(fUniqueURI); - fUniqueURI++; + if (curNode->getElement()) { + fContentSpecOrgURI[fUniqueURI] = curNode->getElement()->getURI(); + curNode->getElement()->setURI(fUniqueURI); + fUniqueURI++; + } if (fUniqueURI == fContentSpecOrgURISize) resizeContentSpecOrgURI(); } diff --git a/src/validators/schema/SubstitutionGroupComparator.cpp b/src/validators/schema/SubstitutionGroupComparator.cpp index 61d4976f7373d81198974de61a303520837dd9be..8d2f082b70c8d98351bb0c90cffd6d41347ec1df 100644 --- a/src/validators/schema/SubstitutionGroupComparator.cpp +++ b/src/validators/schema/SubstitutionGroupComparator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2001/11/07 21:12:15 tng + * Performance: Create QName in ContentSpecNode only if it is a leaf/Any*/PCDataNode. + * * Revision 1.7 2001/10/04 15:08:56 knoaman * Add support for circular import. * @@ -90,6 +93,12 @@ bool SubstitutionGroupComparator::isEquivalentTo(QName* const anElement , QName* const exemplar) { + if (!anElement && !exemplar) + return true; + + if ((!anElement && exemplar) || (anElement && !exemplar)) + return false; + if ((XMLString::compareString(anElement->getLocalPart(), exemplar->getLocalPart()) == 0) && (anElement->getURI() == exemplar->getURI()))