diff --git a/src/xercesc/framework/psvi/PSVIAttributeList.cpp b/src/xercesc/framework/psvi/PSVIAttributeList.cpp index 1b6c1f41909d1542a2d0b87ddad2be976c82ac06..83ad9dc0accd7a3aea9c78f1b3caa3fd9a8a98fe 100644 --- a/src/xercesc/framework/psvi/PSVIAttributeList.cpp +++ b/src/xercesc/framework/psvi/PSVIAttributeList.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/12/20 06:19:38 neilg + * store name/namespace of corresponding attribute in PSVIAttributeList; not all PSVIAttributes have XSAttributeDeclarations + * * Revision 1.4 2003/12/15 17:23:48 cargilld * psvi updates; cleanup revisits and bug fixes * @@ -81,6 +84,8 @@ PSVIAttributeList::PSVIAttributeList( MemoryManager* const manager ): , fAttrPos(0) { fAttrList= new (fMemoryManager) RefVectorOf<PSVIAttribute> (10, true, fMemoryManager); + fAttrNameList= new (fMemoryManager) RefArrayVectorOf<XMLCh> (10, false, fMemoryManager); + fAttrNSList= new (fMemoryManager) RefArrayVectorOf<XMLCh> (10, false, fMemoryManager); } /* @@ -120,7 +125,7 @@ const XMLCh *PSVIAttributeList::getAttributeNameAtIndex(const unsigned int index if(index >= fAttrPos) return 0; - return fAttrList->elementAt(index)->getAttributeDeclaration()->getName(); + return fAttrNameList->elementAt(index); } /* @@ -135,7 +140,7 @@ const XMLCh *PSVIAttributeList::getAttributeNamespaceAtIndex(const unsigned int { if(index >= fAttrPos) return 0; - return fAttrList->elementAt(index)->getAttributeDeclaration()->getNamespace(); + return fAttrNSList->elementAt(index); } /* @@ -149,11 +154,9 @@ PSVIAttribute *PSVIAttributeList::getAttributePSVIByName(const XMLCh *attrName , const XMLCh * attrNamespace) { for (unsigned int index=0; index <= fAttrPos; index++) { - PSVIAttribute* PSVIAttr= fAttrList->elementAt(index); - if (XMLString::equals(attrName,PSVIAttr->getAttributeDeclaration()->getName()) && - XMLString::equals(attrNamespace,PSVIAttr->getAttributeDeclaration()->getNamespace())) { - return PSVIAttr; - } + if (XMLString::equals(attrName,fAttrNameList->elementAt(index)) + && XMLString::equals(attrNamespace,fAttrNSList->elementAt(index))) + return fAttrList->elementAt(index); } return 0; } diff --git a/src/xercesc/framework/psvi/PSVIAttributeList.hpp b/src/xercesc/framework/psvi/PSVIAttributeList.hpp index 18ce2ddf15f69c0eb11ad5406137b21ba208c499..a6841615722cf0328a76a0a82edd38afca5932e8 100644 --- a/src/xercesc/framework/psvi/PSVIAttributeList.hpp +++ b/src/xercesc/framework/psvi/PSVIAttributeList.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/12/20 06:19:38 neilg + * store name/namespace of corresponding attribute in PSVIAttributeList; not all PSVIAttributes have XSAttributeDeclarations + * * Revision 1.5 2003/12/15 17:23:48 cargilld * psvi updates; cleanup revisits and bug fixes * @@ -173,11 +176,16 @@ public: //@{ /** - * returns a PSVI attribute of undetermined state and + * returns a PSVI attribute of undetermined state and given name/namespace and * makes that object part of the internal list. Intended to be called * during validation of an element. + * @param attrName name of this attribute + * @param attrNS URI of the attribute + * @return new, uninitialized, PSVIAttribute object */ - PSVIAttribute *getPSVIAttributeToFill(); + PSVIAttribute *getPSVIAttributeToFill( + const XMLCh * attrName + , const XMLCh * attrNS); /** * reset the list @@ -202,28 +210,44 @@ private: // handler to provide dynamically-need memory // fAttrList // list of PSVIAttributes contained by this object + // fAttrNameList + // list of the names of the initialized PSVIAttribute objects contained + // in this listing + // fAttrNSList + // list of the namespaces of the initialized PSVIAttribute objects contained + // in this listing // fAttrPos - // current number of valid PSVIAttributes in fAttrList + // current number of initialized PSVIAttributes in fAttrList MemoryManager* fMemoryManager; RefVectorOf<PSVIAttribute>* fAttrList; + RefArrayVectorOf<XMLCh>* fAttrNameList; + RefArrayVectorOf<XMLCh>* fAttrNSList; unsigned int fAttrPos; }; inline PSVIAttributeList::~PSVIAttributeList() { delete fAttrList; + delete fAttrNameList; + delete fAttrNSList; } -inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill() +inline PSVIAttribute *PSVIAttributeList::getPSVIAttributeToFill( + const XMLCh *attrName + , const XMLCh * attrNS) { PSVIAttribute *retAttr = 0; if(fAttrPos == fAttrList->size()) { retAttr = new (fMemoryManager)PSVIAttribute(fMemoryManager); - fAttrList->addElement(retAttr); + fAttrList->addElement(retAttr); + fAttrNameList->addElement((XMLCh *)attrName); + fAttrNSList->addElement((XMLCh *)attrNS); } else { retAttr = fAttrList->elementAt(fAttrPos); + fAttrNameList->setElementAt((XMLCh *)attrName, fAttrPos); + fAttrNSList->setElementAt((XMLCh *)attrNS, fAttrPos); } fAttrPos++; return retAttr;