Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
1.1 Final
-
None
-
All
Description
Current CVS state don't handle well the following case with Xerces:
<tag/>
or
<tag></tag>
<tag1>Test</tag1>
With the last CVS contains, by adding Next(Boolean) API to parser, the deserialization process not end with segfault as before. But value returned just after an empty element is wrong. For more information see : http://marc.theaimsgroup.com/?t=108137002000002&r=1&w=2
Also when an element has more than on attribute only the first is returned (see patch)
— c/src/soap/SoapParserXerces.cpp Fri Apr 9 14:44:08 2004
+++ src/soap/SoapParserXerces.cpp Fri Apr 9 15:48:24 2004
@@ -58,6 +58,7 @@
m_pParser->parseReset(token);
firstParsed = false;
}
+ Xhandler.ResetEmptyElement();
return 0;
}
@@ -81,6 +82,12 @@
firstParsed = true;
}
+ if ( Xhandler.GetEmptyElement() )
+
+
Xhandler.freeElement();
while (true)
{
— c/src/soap/XercesHandler.cpp Thu Apr 8 15:21:50 2004
+++ src/soap/XercesHandler.cpp Fri Apr 9 15:48:39 2004
@@ -47,16 +47,21 @@
unsigned int len = attrs.getLength();
unsigned int index;
+ unsigned int xercesIndex;
+ xercesIndex = 0;
+
for (index = 0; index < len*3; index+=3)
Nelement->m_pchAttributes[len*3]=NULL;
+ m_nEmptyElement = 0;
}
const XML_Ch* XercesHandler::NS4Prefix(const XML_Ch* prefix)
@@ -74,6 +79,7 @@
m_pCurrElement = Nelement;
Nelement->m_type = CHARACTER_ELEMENT;
Nelement->m_pchNameOrValue = XMLString::transcode(chars);
+ m_nEmptyElement = 0;
}
void XercesHandler::ignorableWhitespace(const XMLCh* const chars,
const unsigned int length)
@@ -97,6 +103,10 @@
const XMLCh *const localname,
const XMLCh *const qname)
{
+ if ( m_pCurrElement == Nelement )
+ m_nEmptyElement = 1;
+ else
+ m_nEmptyElement = 0;
m_pCurrElement = Nelement;
Nelement->m_type = END_ELEMENT;
Nelement->m_pchNameOrValue = XMLString::transcode(localname);
— c/src/soap/XercesHandler.h Thu Apr 8 15:21:50 2004
+++ src/soap/XercesHandler.h Fri Apr 9 15:48:06 2004
@@ -35,6 +35,8 @@
public :
void freeElement();
int GetStatus()
;
+ int GetEmptyElement()
;
+ void ResetEmptyElement()
;
/* -----------------------------------------------------------------------
- Constructors
- -----------------------------------------------------------------------
@@ -77,6 +79,7 @@
void fatalError(const SAXParseException& exception);
int m_nStatus;
+ int m_nEmptyElement;
AnyElement * Nelement;
AnyElement * m_pCurrElement;