Hello, I use xerces-c 2.1.0.
The XML files I need to validate: - contain NO reference to the DTD (e.g. no DOCTYPE). - don't contain the xml header (<?xml version ... ?>), though this is not the issue here XML example: <DICT> <SE clevel="2"> <HW>maison</HW> <S1> <O1> <PS>noun</PS> </O1> <S2> <S3> <!--noun--> <TR>house</TR> </S3> </S2> </S1> </SE> </DICT> The DTD against which I need to validate will probably be stored in a MemBufInputSource object: I don't need (want) to have an external file to store it. DTD: <!DOCTYPE DICT [ <!ELEMENT DICT (SE+)> <!ELEMENT SE (HW,S1+)> <!ATTLIST SE clevel (2) \"2\"> <!ELEMENT HW (#PCDATA)> <!ELEMENT S1 (O1,S2)> <!ELEMENT O1 (PS)> <!ELEMENT PS (#PCDATA)> <!ELEMENT S2 (S3+)> <!ELEMENT S3 (LC?,CPDRE?,TR+)> <!ELEMENT CPDRE (#PCDATA)> <!ELEMENT LC (#PCDATA)> <!ELEMENT TR (#PCDATA)> ]> I have seen many messages more or less related to the subject of this message. It seems that a/the solution resides in: - using the grammar caching mechanism and/or - using a specific EntityResolver I tried different solutions but up to now none of them worked: Using DTD caching mechanism: - create an in-memory XML buffer containing inline DTD + a small piece of data which conforms to the DTD - create a validating parser - parse the in-memory input source then set parser's fgXercesUseCachedGrammarInParse feature to true - parse actual XML files using the same parser --> still validation errors Using my own EntityResolver: - the resolveEntity is not called, so that I can't feed the parser with my DTD definition. I guess this is because the XML doesn't contain DOCTYPE definition... By the way, having no DOCTYPE is maybe the reason why the grammar caching doesn't work (if cached grammars are more or less associated to their DOCTYPE, what occurs if there is no DOCTYPE?) Did somebody faced the same problem? Is there a way to have my EntityResolver's resolveEntity method called despite the fact that the XML doesn't contain DOCTYPE definition? Thanks in advance for any suggestion, Yves --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
