Hi Christoph,

I've not used DTDs but it looks to me like the definition for "Name" in the dtd provided is a comment !

Thus, the parser would give out, basically it would be saying you've added a "Name" element in your document but it's not defined in your DTD.

:)

Regards

Dm

Christoph Kies wrote:

Hello everybody,

This is my first day with xerces-c++ and i think i will use it. I found no other c++ library at that high level. Respect and thanks to the developers.
I mangaged to complie and install it, and to parse a file.

But the validation does not behave as i expect.
I thought i would get an error, because <Task> has no member <Name>.

Can someone please help?
---- todo.xml: ----

<?xml version="1.0" standalone="no"?>
<!DOCTYPE TodoList SYSTEM "todo.dtd">
<TodoList>
 <Task>
   <Name>do something</Name>
 </Task>
</TodoList>

---- todo.dtd: ----

<!-- DTD for Todo project -->
<!ELEMENT TodoList (Task)>
<!ELEMENT Task EMPTY>
<!-- ELEMENT Name (#PCDATA) -->

---- code: ----

        XMLPlatformUtils::Initialize();
        XercesDOMParser* parser = new XercesDOMParser();

        parser->setValidationScheme(XercesDOMParser::Val_Always);
        parser->setValidationSchemaFullChecking(true);
        parser->setIncludeIgnorableWhitespace(false);
        parser->setDoNamespaces(true);

        ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
        parser->setErrorHandler(errHandler);

        parser->parse("todo.xml");





--
Regards,

Dara Mulvihill,

Rísarís Ltd,

http://www.risaris.com

++353 404 64009




Reply via email to