You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2005/03/04 15:02:40 UTC
cvs commit: ws-axis/c/src/soap HeaderBlock.cpp
prestonf 2005/03/04 06:02:40
Modified: c/src/soap HeaderBlock.cpp
Log:
Hi All,
I think this will complete what needs to be done for AXISCPP-341.
Regards,
Fred Preston.
Revision Changes Path
1.58 +38 -7 ws-axis/c/src/soap/HeaderBlock.cpp
Index: HeaderBlock.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/HeaderBlock.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- HeaderBlock.cpp 1 Mar 2005 12:16:16 -0000 1.57
+++ HeaderBlock.cpp 4 Mar 2005 14:02:40 -0000 1.58
@@ -413,17 +413,48 @@
return iStatus;
}
-INamespace* HeaderBlock::createNamespaceDecl(const AxisChar *prefix,
- const AxisChar *uri)
+INamespace* HeaderBlock::createNamespaceDecl( const AxisChar * pPrefix, const AxisChar * pURI)
{
- if(prefix==NULL || uri==NULL)
+// Check that the prefix and uri are valid pointers and that the string is not
+// empty.
+ if( pPrefix != NULL && strlen( pPrefix) > 0 &&
+ pURI != NULL && strlen( pURI) > 0)
{
- return NULL;
+
+// Iterate through the namespaces checking that the prefix does not already
+// exist.
+ bool bNameFound = false;
+ list<Namespace*>::iterator itCurrNamespaceDecl = m_namespaceDecls.begin();
+
+ while( itCurrNamespaceDecl != m_namespaceDecls.end() && !bNameFound)
+ {
+ if( !(bNameFound = !strcmp( (*itCurrNamespaceDecl)->getPrefix(), pPrefix)))
+ {
+ itCurrNamespaceDecl++;
+ }
+ }
+
+// If the prefix is found in the declared namespace list, then update the uri
+// for the prefix and return a pointer to that namespace.
+ if( bNameFound)
+ {
+ (*itCurrNamespaceDecl)->setURI( pURI);
+
+ return (INamespace *) *itCurrNamespaceDecl;
}
- Namespace* pNamespace = new Namespace(prefix, uri);
- m_namespaceDecls.push_back(pNamespace);
- return (INamespace*)pNamespace;
+// If the prefix was not found, then create a new namespace for the prefix/uri
+// pair and return the pointer to the new namespace.
+ Namespace * pNamespace = new Namespace( pPrefix, pURI);
+
+ m_namespaceDecls.push_back( pNamespace);
+
+ return (INamespace *) pNamespace;
+ }
+ else
+ {
+ return NULL;
+ }
}
/* TO DO: We need to remove this completely