You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/11/07 22:12:15 UTC

cvs commit: xml-xerces/c/src/validators/schema ComplexTypeInfo.cpp SubstitutionGroupComparator.cpp

tng         01/11/07 13:12:15

  Modified:    c/src/validators/DTD DTDElementDecl.cpp
               c/src/validators/common ContentSpecNode.cpp
                        ContentSpecNode.hpp
               c/src/validators/schema ComplexTypeInfo.cpp
                        SubstitutionGroupComparator.cpp
  Log:
  Performance: Create QName in ContentSpecNode only if it is a leaf/Any*/PCDataNode.
  
  Revision  Changes    Path
  1.17      +6 -4      xml-xerces/c/src/validators/DTD/DTDElementDecl.cpp
  
  Index: DTDElementDecl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/DTD/DTDElementDecl.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DTDElementDecl.cpp	2001/09/05 20:49:10	1.16
  +++ DTDElementDecl.cpp	2001/11/07 21:12:15	1.17
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DTDElementDecl.cpp,v 1.16 2001/09/05 20:49:10 knoaman Exp $
  + * $Id: DTDElementDecl.cpp,v 1.17 2001/11/07 21:12:15 tng Exp $
    */
   
   
  @@ -359,11 +359,13 @@
           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
  
  
  
  1.8       +2 -2      xml-xerces/c/src/validators/common/ContentSpecNode.cpp
  
  Index: ContentSpecNode.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/common/ContentSpecNode.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContentSpecNode.cpp	2001/10/12 18:07:56	1.7
  +++ ContentSpecNode.cpp	2001/11/07 21:12:15	1.8
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: ContentSpecNode.cpp,v 1.7 2001/10/12 18:07:56 tng Exp $
  + * $Id: ContentSpecNode.cpp,v 1.8 2001/11/07 21:12:15 tng Exp $
    */
   
   
  @@ -84,7 +84,7 @@
       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)
  
  
  
  1.17      +10 -8     xml-xerces/c/src/validators/common/ContentSpecNode.hpp
  
  Index: ContentSpecNode.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/common/ContentSpecNode.hpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ContentSpecNode.hpp	2001/08/28 20:21:08	1.16
  +++ ContentSpecNode.hpp	2001/11/07 21:12:15	1.17
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: ContentSpecNode.hpp,v $
  + * 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 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 @@
       , fMinOccurs(1)
       , fMaxOccurs(1)
   {
  -    fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId);
   }
   
   inline
  @@ -301,9 +303,7 @@
       , 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 @@
       , fMinOccurs(1)
       , fMaxOccurs(1)
   {
  -    fElement = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, XMLElementDecl::fgInvalidElemId);
   }
   
   
  @@ -420,7 +419,9 @@
   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)
  
  
  
  1.21      +12 -5     xml-xerces/c/src/validators/schema/ComplexTypeInfo.cpp
  
  Index: ComplexTypeInfo.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/schema/ComplexTypeInfo.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ComplexTypeInfo.cpp	2001/10/12 18:08:57	1.20
  +++ ComplexTypeInfo.cpp	2001/11/07 21:12:15	1.21
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: ComplexTypeInfo.cpp,v $
  + * 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 @@
       //  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 @@
   
       // 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();
       }
  
  
  
  1.8       +9 -0      xml-xerces/c/src/validators/schema/SubstitutionGroupComparator.cpp
  
  Index: SubstitutionGroupComparator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/schema/SubstitutionGroupComparator.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SubstitutionGroupComparator.cpp	2001/10/04 15:08:56	1.7
  +++ SubstitutionGroupComparator.cpp	2001/11/07 21:12:15	1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: SubstitutionGroupComparator.cpp,v $
  + * 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()))
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org