Re: DTD and XmlReaderSettings

Tech-Archive recommends: Speed Up your PC by fixing your registry



XmlReaderSettings.Schemas property returns an XmlSchemaSet object that can
only accept W3C XML Schema and not DTDs.
If you have a DTD file, you should either specify the DTD as an internal
subset in the xml file itself or provide the dtd file name at the beginning
of your xml file.

<!DOCTYPE Root SYSTEM "application.dtd">
<Root>
<Content>
....
</Content>
</Root>

Or

<!DOCTYPE Root [
<!ELEMENT Content ANY>
]>
<Root>
<Content>
....
</Content>
</Root>
-Priya

<pawel.pabich@xxxxxxxxx> wrote in message
news:1126694953.917940.151490@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hajo,
>
> I want to validate xml against DTD but I am not able to load DTD
> schema.
> My code looks like that:
>
> XmlReaderSettings settings = new XmlReaderSettings();
> settings.ProhibitDtd = false;
> settings.ValidationType = ValidationType.DTD;
> settings.ValidationEventHandler += new
> ValidationEventHandler(ValidationCallBack);
> settings.Schemas.Add(null,@"C:\application.dtd");
>
> and I at last line I always get this error:
>
> 'ELEMENT' is an unexpected token. The expected token is 'DOCTYPE'. Line
> 38, position 3.
>
> Below I enclose 38th line of DTD.
> <!ELEMENT eu-application:applicationform (
> declaration
> , application
> , maa-particulars
> , scientific-advice
> , paediatric-program
> , other-maa
> , annexed-documents
> )>
>
> But DTD should be ok because XMLSpy says that is well-formed. Any idea
> what it is wrong?
>
>
> thanks in advance
>
> Pawel Pabich
>


.



Relevant Pages

  • Re: Lets think who will like to say delphi is dying?
    ... if that particular DTD rules it out. ... there are 2 basic usage forms for XML. ... HTML is/canbe quite strict too. ... Parsing and compiling are kind of the same thing.. ...
    (borland.public.delphi.non-technical)
  • Re: standalone validating XML parser for Solaris?
    ... the unix command line to validate large XML files against an XML DTD. ... Older versions only parse but dont validate. ... More recent versions can validate against DTD or Schema. ...
    (comp.text.xml)
  • Re: DTD in browsers
    ... statement that "DTD for XML are always fetched" is totally correct. ... It is definitely fetched by XML parsers in known Web ... I just presume that Thomas was not aware of the current bug in Gecko ... agree that there is only one DOCTYPE and only one DTD mechanics equal ...
    (comp.infosystems.www.authoring.html)
  • Re: A new paradigm
    ... AccuTerm GUI application for the WinDoze types and a ... With Coyote and a finished XML project, I'm sure that all of that could ... Tom H has taken over the DTD stuff recently ... XML-based development under OpenQM should take part in discussions on the ...
    (comp.databases.pick)
  • How to skip validation of DTD file on VB.Net when the DTD is offline
    ... OK - I have an XML file from a vendor that uses a DTD files as follows: ... A connection attempt failed because ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& ...
    (microsoft.public.dotnet.languages.vb)