Hi, all,

 

I am a new  xerces c++ users, and I am working on a project that uses xerces c++ 1.7 SAX parser. I have a question regarding setting up a validating SAX parser.  I did the following when I set up the parser:

 

             ******

 

      SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();

      pParser->setFeature(XMLUni::fgSAX2CoreValidation, true);

      pParser->setFeature(XMLUni::fgSAX2XercesDynamic, true);

 

             *****

 

But when I run the code, it seems the validation does not occur, for example, the DTD defines an element as the following:

 

<!ELEMENT email EMPTY>

<!ATTLIST email value CDATA #FIXED "[EMAIL PROTECTED]">

 

Which means that the email element has an attribute with fixed value [EMAIL PROTECTED], however, when I have a xml instance contain an element

 

    <email value="[EMAIL PROTECTED]"></email>

 

It does not fail.

 

My xml instance file has the following line

 

<!DOCTYPE personnel SYSTEM "C:/mylocation/meta.dtd">

 

Which is the DTD location that governs my xml instances.

 

What else I need to do set up the parser correctly?  And how about if the meta data is an XML schema?

 

Thanks in advance.

 

Frank

Reply via email to