Hello,
I have no problem to load an external DTD, just the problem, that the DTD is
found (when i change the filename in "loadGrammar(path)" i get an error, but
when I have it like I have it written upwards, the loading throws no error)
but he got the DTD not really.
The DTD and the XML-File should be ok, because when I open open it with a
browser he says, its Ok and shows me the entries.
But if you want to see them, here are small examples:
DTD
---------------------------------------------------------------
<!ELEMENT IMD (TransMat , ObjectSchemes , VerbalDescriptions , (IMD)*>
<!ELEMENT TransMat (row1 , row2 , row3 , row4)>
<!ATTLIST TransMat
isAnchored CDATA #REQUIRED
>
<!ELEMENT row1 (#PCDATA)>
<!ELEMENT row2 (#PCDATA)>
<!ELEMENT row3 (#PCDATA)>
<!ELEMENT row4 (#PCDATA)>
<!ELEMENT ObjectSchemes (Scheme)*>
<!ELEMENT Scheme (Axis)+>
<!ATTLIST Scheme
dim CDATA #REQUIRED
numAxes CDATA 'REQUIRED
>
<ELEMENT Axis (#PCDATA)>
<!ELEMENT VerbalDescriptions (vDescription)*>
<!ELEMENT vDescription (#PCDATA)>
----------------------------------------------------------------------------
---------
XML-File
----------------------------------------------------------------------------
---------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE IMD SYSTEM "IMD.dtd">
<IMD>
<TransMat isAnchored=0>
<row1>1 0 0 0</row1>
<row2>0 1 0 0</row2>
<row3>0 0 1 0</row3>
<row4>0 0 0 1</row4>
</TransMat>
<ObjectSchemes>
<Scheme dim=3 numAxes=1>
<Axis>228 0 3 0 0 0 0</Axis>
</Scheme>
<Scheme dim=3 numAxes=2>
<Axis>228 0 1 0 0 0 1</Axis>
<Axis>228 0 2 0 0 0 0</Axis>
</Scheme>
<Scheme dim=3 numAxes=2>
<Axis>228 0 2 0 0 0 0</Axis>
<Axis>228 0 1 0 0 0 1</Axis>
</Scheme>
</ObjectSchemes>
<VerbalDescriptions>
<VDescription>rund</VDescription>
<VDescription>round</VDescription>
</VerbalDescriptions>
</IMD>
----------------------------------------------------------------------------
-------
Maybe some idea? Or is it not enough, to laod the grammar over the
loadGrammar()-function?
Kai Lienemann
----
Artificial Intelligence Group
Faculty of Technology
University of Bielefeld
----- Original Message -----
From: "Gr�ndal Daniel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Kai Lienemann"
<[EMAIL PROTECTED]>
Sent: Friday, May 28, 2004 10:04 AM
Subject: SV:Repost: Only errors by validating a well-form ed XML-File
against a DTD
Hi,
What does your DTD look like?
Are you sure it is correct? Sometimes the problem is easier to solve then
expected...
Just to start with....
//daniel
Kai Lienemann (2004-05-28 09:58):
>I psoted this question some weeks ago and got no answer. But I think it
>can't be so difficult, although I find no solution. Maybe somebody had the
>same problem?
>So here is the question:
>
>Hello,
>
>I want to validate my XML-Files against a specific DTD-File. Because every
>File shoul be validated with the same DTD-File I tell the parser the
>location of the DTD with the loadGrammar function. It seems he found the
DTD
>but by parsing the XML-File every Element and Attribute throws an error.
>
>Can somebody help me or give me a hint???
>
>Here is the part of the programm, where the parser is build:
>
>xercesc::XercesDOMParser::ValSchemes valScheme =
>xercesc::XercesDOMParser::Val_Always;
>
>xercesc::XercesDOMParser *parser = new xercesc::XercesDOMParser;
>parser->setValidationScheme(valScheme);
>parser->setDoNamespaces(false);
>parser->setDoSchema(false);
>parser->setValidationSchemaFullChecking(true);
>
>
>file://set an ErrorHandler
>DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
>parser->setErrorHandler(errReporter);
>
>
>const char* xmlFile = filename.c_str();
>
>try
>{
>// Load grammar and cache it
>parser->resetCachedGrammarPool();
>
>parser->loadGrammar("/amd/callisto/users/wbsstud01/klienema/personal.dtd",
>xercesc::Grammar::DTDGrammarType, false);
>
>// enable grammar reuse
>parser->useCachedGrammarInParse(true);
>parser->cacheGrammarFromParse(true);
>
>file://parse the file and report the errors
>parser->parse(xmlFile);
>int errorCount = parser->getErrorCount();
>cerr << errorCount << " errors" << endl;
>cerr << "success" << endl;
>}
>
>
>
>
>here is some part of the outputed errors:
>
>Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml",
>line 144, column 47
>Message: Attribute 'deg' is not declared for element 'Axis'
>Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml",
>line 144, column 66
>Message: Attribute 'abs_deg' is not declared for element 'Axis'
>Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml",
>line 144, column 80
>Message: Attribute 'rel_deg' is not declared for element 'Axis'
>Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml",
>line 150, column 24
>Message: Unknown element 'VerbalDescriptions'
>Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml",
>line 151, column 22
>
>
>Thx
>
>Kai Lienemann
>
>----
>Artificial Intelligence Group
>Faculty of Technology
>University of Bielefeld
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
__________________________________________________________
RFV Data/Produktenheten E-post: [EMAIL PROTECTED]
Daniel Gr�ndal Tfn: 060-187126
S:a J�rnv�gsgatan 41 Mobil: 070-3016517
851 93 Sundsvall Fax: 060-147870
__________________________________________________________
---------------------------------------------------------------------
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]