It actually works with xml schemas:
- I converted my DTD to an xsd (using XMLSpy)
- the following code works:

parser = XMLReaderFactory::createXMLReader();
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgXercesDynamic, false);
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
L"myschema.xsd");
parser->parse("mydocument.xml");

Note that:
- mydocument.xml doesn't need to reference to myschema.xsd
- take care to setProperty (for
fgXercesSchemaExternalNoNameSpaceSchemaLocation): it accepts a void* but the
given value is assumed to be an XMLCh* (unicode), not a char*

Yves

> -----Original Message-----
> From: Yves Monier [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 04, 2003 5:10 PM
> To: [EMAIL PROTECTED]
> Subject: RE: validating XML without DOCTYPE
>
>
> Hello,
>
> I had the same problem 2 days ago!
> (http://marc.theaimsgroup.com/?l=xerces-c-dev&m=106246309804928&w=2)
> And the answer is: you can't :-(
>
> But Neil Graham answered that it is possible with schemas
> (thanks Neil, I'm
> investigating this!)
>
> Yves
>
> > -----Original Message-----
> > From: Christian Brock [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 04, 2003 4:28 PM
> > To: [EMAIL PROTECTED]
> > Subject: validating XML without DOCTYPE
> >
> >
> > Hello everybody:
> >
> > I receive an XML document without a <!DOCTYPE ...> tag.
> >
> > I still want to validate the message against an existing DTD.
> >
> > How?
> >
> > Thanks --Chr.
> >
> > --------------------------------------
> > Christian Brock <brock AT ivi.fhg.de>
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to