Re: DTD and XmlReaderSettings
- From: "Priya Lakshminarayanan [MSFT]" <priyal@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Sep 2005 17:12:51 -0700
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
>
.
- References:
- DTD and XmlReaderSettings
- From: pawel . pabich
- DTD and XmlReaderSettings
- Prev by Date: Re: XSD annotations?
- Next by Date: Serialization & Deserialization
- Previous by thread: Re: DTD and XmlReaderSettings
- Next by thread: Parsing an XML file, ERROR: The remote server returned an error: (407) Proxy Authentication Required. HELP!
- Index(es):
Relevant Pages
|