[xsd-users] Validation results not as expected.

Stephen James Stephen.James at genband.com
Tue Jan 26 15:55:48 EST 2010


I basically copied the code from your driver example for initializing
the DOM and parsing, the only difference I could find was that I was
reading the xml document from a buffer, rather than from a stream. Note,
my DOMLSParser* object and my tree::error_handler objects are file local
static objects.

>From the working standalone code
                xml::sax::std_input_source isrc (ifs, argv[j]);
                Wrapper4InputSource wrap (&isrc, false);

Code that is not detecting all errors:
	XMLCh bufid;
	MemBufInputSource mem(buffer, len, &bufid);
	Wrapper4InputSource wrap (&mem, false);

Also, how would I reset the error handler in the error_handler_proxy
object?
I am initializing everything once, caching the schema file and then
processing the xml files as they are received over a socket interface.

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Monday, January 25, 2010 2:06 PM
To: Stephen James
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Validation results not as expected.

Hi Stephen,

Stephen James <Stephen.James at genband.com> writes:

> The following xml does not throw an exception: Note the first
> <component> is not terminated

I tried to reproduce this by modifying the hello.xml file in the 
examples/cxx/tree/hello like this (that is, unterminated greeting 
element):

<hello xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="hello.xsd">

  <greeting>Hello

  <name>sun</name>
  <name>moon</name>
  <name>world</name>

</hello>

I tried with validation enabled and disabled and in both cases
I get:

bad.xml:20:3 error: expected end of tag 'greeting'

So there has to be something special about the way you do parsing. 
Can you show the relevant code or even better try to modify one of 
the example to reproduce the problem?

Boris



More information about the xsd-users mailing list