gareth 2003/01/29 11:57:30 Modified: c/src/xercesc/validators/schema ComplexTypeInfo.hpp ComplexTypeInfo.cpp Log: API to retrive local and uri part of the type name Revision Changes Path 1.9 +35 -5 xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.hpp Index: ComplexTypeInfo.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ComplexTypeInfo.hpp 3 Jan 2003 16:38:34 -0000 1.8 +++ ComplexTypeInfo.hpp 29 Jan 2003 19:57:30 -0000 1.9 @@ -132,6 +132,8 @@ XMLContentModel* getContentModel(const bool checkUPA = false); const XMLCh* getFormattedContentModel () const; XSDLocator* getLocator() const; + const XMLCh* getTypeLocalName() const; + const XMLCh* getTypeUri() const; /** * returns true if this type is anonymous @@ -222,6 +224,8 @@ unsigned int fElementId; int fContentType; XMLCh* fTypeName; + XMLCh* fTypeLocalName; + XMLCh* fTypeUri; DatatypeValidator* fBaseDatatypeValidator; DatatypeValidator* fDatatypeValidator; ComplexTypeInfo* fBaseComplexTypeInfo; @@ -303,7 +307,6 @@ } inline XMLCh* ComplexTypeInfo::getTypeName() const { - return fTypeName; } @@ -394,6 +397,33 @@ return fAnonymous; } +inline const XMLCh* ComplexTypeInfo::getTypeLocalName() const +{ + if(!fTypeLocalName) { + int index = XMLString::indexOf(fTypeName, chComma); + int length = XMLString::stringLen(fTypeName); + XMLCh *tName = new XMLCh[length - index + 1]; + XMLString::subString(tName, fTypeName, index + 1, length); + ((ComplexTypeInfo *)this)->fTypeLocalName = tName; + } + + return fTypeLocalName; +} + +inline const XMLCh* ComplexTypeInfo::getTypeUri() const +{ + + if(!fTypeUri) { + int index = XMLString::indexOf(fTypeName, chComma); + int length = XMLString::stringLen(fTypeName); + XMLCh *uri = new XMLCh[index + 1]; + XMLString::subString(uri, fTypeName, 0, index); + ((ComplexTypeInfo *)this)->fTypeUri = uri; + } + + return fTypeUri; +} + // --------------------------------------------------------------------------- // ComplexTypeInfo: Setter methods // --------------------------------------------------------------------------- @@ -450,9 +480,9 @@ inline void ComplexTypeInfo::setTypeName(const XMLCh* const typeName) { - if (fTypeName != 0) { - delete [] fTypeName; - } + delete [] fTypeName; + delete [] fTypeLocalName; + delete [] fTypeLocalName; fTypeName = XMLString::replicate(typeName); } 1.6 +7 -0 xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.cpp Index: ComplexTypeInfo.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ComplexTypeInfo.cpp 19 Dec 2002 14:04:05 -0000 1.5 +++ ComplexTypeInfo.cpp 29 Jan 2003 19:57:30 -0000 1.6 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/01/29 19:57:30 gareth + * API to retrive local and uri part of the type name + * * Revision 1.5 2002/12/19 14:04:05 gareth * get/set methods to see if the represented type is anonymous. Patch by Peter Volchek. * @@ -185,6 +188,8 @@ , fElementId(XMLElementDecl::fgInvalidElemId) , fContentType(SchemaElementDecl::Empty) , fTypeName(0) + , fTypeLocalName(0) + , fTypeUri(0) , fBaseDatatypeValidator(0) , fDatatypeValidator(0) , fBaseComplexTypeInfo(0) @@ -209,6 +214,8 @@ ComplexTypeInfo::~ComplexTypeInfo() { delete [] fTypeName; + delete [] fTypeLocalName; + delete [] fTypeUri; if (fAdoptContentSpec) { delete fContentSpec;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]