Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.7.0
-
None
-
None
-
Windows 2000 SP4
Visual Studio .NET 2003
Description
When XMLSchema validation is enabled, some whitespaces are reported neither characters() nor ignorableWhitespace() event.
Following is output of sample program which is attached below.
<characters>1234 5678 1234 5678 1234 5678 1234 5678</characters>
<characters> 1234 5678 1234 5678 1234 5678 1234 5678 1234 5678</characters>
<characters>1234 5678 1234 5678 1234 5678 1234 5678</characters>
<characters> 1234 5678</characters>
Between the 2nd and 3rd characters() event, whitespace is lost.
Is it distinguishable the last token of 2nd event and first token of 3rd event are differenet words or parts of continuous word?
Regards,
Takashi Matsuda.
======================
Sample Program:
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <iostream>
#ifndef SCHEMA_VALIDATION
#define SCHEMA_VALIDATION 1
#endif
using namespace XERCES_CPP_NAMESPACE;
static const char source[] =
"<?xml version='1.0' encoding='ascii' ?>\n"
"<list xmlns='http://myNameSpace/'\n"
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n"
" xsi:schemaLocation='http://myNameSpace/ schema.xsd'\n"
">\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
" 1234 5678\n"
"</list>";
static const char schema[] =
"<?xml version='1.0' encoding='ascii' ?>\n"
"<xsd:schema\n"
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n"
" targetNamespace='http://myNameSpace/'\n"
" xmlns='http://myNameSpace/'\n"
">\n"
"<xsd:element name='list' type='list_type' />\n"
"<xsd:simpleType name='list_type'>\n"
"<xsd:list itemType='xsd:unsignedInt' />\n"
"</xsd:simpleType>\n"
"</xsd:schema>";
class MyHandler : public DefaultHandler
{
public:
void characters(const XMLCh* const chars, const unsigned int length)
void ignorableWhitespace(const XMLCh* const chars, const unsigned int length)
{ std::wstring message(chars, length); std::wcout << "<ignorableWhitespace>" << message.c_str() << "</ignorableWhitespace>" << std::endl; }};
int main(int argc, char* argv[])
{
XMLPlatformUtils::Initialize();
XMLPlatformUtils::Terminate();
return 0;
}